rename object to platform, refact of file names
This commit is contained in:
@@ -10,7 +10,7 @@ type Domain struct {
|
||||
}
|
||||
|
||||
func (d *Domain) Init() {
|
||||
d.InitObjectType()
|
||||
d.InitPlatformType()
|
||||
d.InitItemType()
|
||||
d.InitNPCType()
|
||||
d.InitMenu()
|
||||
|
||||
@@ -12,24 +12,24 @@ func (d *Domain) InitLevel() {
|
||||
Render: konstructor.Render{
|
||||
Image: "assets/images/playgrounds/level_1_playground_1.png",
|
||||
},
|
||||
Objects: []konstructor.Object{
|
||||
Platforms: []konstructor.Platform{
|
||||
{
|
||||
ID: "test_object",
|
||||
ID: "test_platform",
|
||||
Position: konstructor.Position{
|
||||
X: 10,
|
||||
Y: 10,
|
||||
Z: 0,
|
||||
},
|
||||
Type: d.GetObjectType(TestObjectType),
|
||||
Type: d.GetPlatformType(TestPlatformType),
|
||||
},
|
||||
{
|
||||
ID: "test_object2",
|
||||
ID: "test_platform2",
|
||||
Position: konstructor.Position{
|
||||
X: 50,
|
||||
Y: 50,
|
||||
Z: 0,
|
||||
},
|
||||
Type: d.GetObjectType(TestObjectType),
|
||||
Type: d.GetPlatformType(TestPlatformType),
|
||||
},
|
||||
},
|
||||
Items: []konstructor.Item{
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
package domain
|
||||
|
||||
import "game/konstructor"
|
||||
|
||||
const (
|
||||
TestObjectType konstructor.ObjectTypeMapKey = "test"
|
||||
)
|
||||
|
||||
func (d *Domain) InitObjectType() {
|
||||
d.ObjectTypeMap = konstructor.ObjectTypeMap{
|
||||
TestObjectType: konstructor.ObjectType{
|
||||
ID: "test_object_type",
|
||||
Render: konstructor.Render{
|
||||
Image: "assets/images/objects/test_object.png",
|
||||
Width: 30,
|
||||
Height: 30,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (d *Domain) GetObjectTypeMap() konstructor.ObjectTypeMap {
|
||||
return d.ObjectTypeMap
|
||||
}
|
||||
|
||||
func (d *Domain) GetObjectType(name konstructor.ObjectTypeMapKey) konstructor.ObjectType {
|
||||
value, _ := d.ObjectTypeMap[name]
|
||||
return value
|
||||
}
|
||||
29
domain/type.platform.go
Normal file
29
domain/type.platform.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package domain
|
||||
|
||||
import "game/konstructor"
|
||||
|
||||
const (
|
||||
TestPlatformType konstructor.PlatformTypeMapKey = "test"
|
||||
)
|
||||
|
||||
func (d *Domain) InitPlatformType() {
|
||||
d.PlatformTypeMap = konstructor.PlatformTypeMap{
|
||||
TestPlatformType: konstructor.PlatformType{
|
||||
ID: "test_platform_type",
|
||||
Render: konstructor.Render{
|
||||
Image: "assets/images/platforms/test_platform.png",
|
||||
Width: 30,
|
||||
Height: 30,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (d *Domain) GetPlatformTypeMap() konstructor.PlatformTypeMap {
|
||||
return d.PlatformTypeMap
|
||||
}
|
||||
|
||||
func (d *Domain) GetPlatformType(name konstructor.PlatformTypeMapKey) konstructor.PlatformType {
|
||||
value, _ := d.PlatformTypeMap[name]
|
||||
return value
|
||||
}
|
||||
Reference in New Issue
Block a user