diff --git a/domain/inventory.go b/domain/inventory.go new file mode 100644 index 0000000..467f83c --- /dev/null +++ b/domain/inventory.go @@ -0,0 +1,15 @@ +package domain + +import "game/konstructor/entity" + +func (d *Domain) AddToInventory(item *entity.Item) bool { + return true +} + +func (d *Domain) RemoveFromInventory(item *entity.Item) bool { + return true +} + +func (d *Domain) UseInventoryItem(item *entity.Item) bool { + return true +} diff --git a/konstructor/engine/engine.inventory.go b/konstructor/engine/engine.inventory.go new file mode 100644 index 0000000..dfb1994 --- /dev/null +++ b/konstructor/engine/engine.inventory.go @@ -0,0 +1,15 @@ +package engine + +import "game/konstructor/entity" + +func (e *Engine) AddToInventory(item *entity.Item) { + e.Domain.AddToInventory(item) +} + +func (e *Engine) RemoveFromInventory(item *entity.Item) { + e.Domain.RemoveFromInventory(item) +} + +func (e *Engine) UseInventoryItem(item *entity.Item) { + e.Domain.UseInventoryItem(item) +} diff --git a/konstructor/entity/entity.domain.go b/konstructor/entity/entity.domain.go index 3807996..6b2522e 100644 --- a/konstructor/entity/entity.domain.go +++ b/konstructor/entity/entity.domain.go @@ -7,4 +7,7 @@ type DomainInterface interface { GetDialog(name string) Dialog SetDialog(name string, menu Dialog) GetLevel(index int) Level + AddToInventory(item *Item) bool + RemoveFromInventory(item *Item) bool + UseInventoryItem(item *Item) bool } diff --git a/konstructor/entity/entity.item.go b/konstructor/entity/entity.item.go new file mode 100644 index 0000000..09bf7b5 --- /dev/null +++ b/konstructor/entity/entity.item.go @@ -0,0 +1,12 @@ +package entity + +type ItemType struct { + ID string + RenderOptions RenderOptions +} + +type Item struct { + ID string + Type ItemType + Position Position +} diff --git a/konstructor/entity/entity.npc.go b/konstructor/entity/entity.npc.go new file mode 100644 index 0000000..fc6ac37 --- /dev/null +++ b/konstructor/entity/entity.npc.go @@ -0,0 +1,12 @@ +package entity + +type NPCType struct { + ID string + RenderOptions RenderOptions +} + +type NPC struct { + ID string + Type NPCType + Position Position +} diff --git a/konstructor/entity/entity.object.go b/konstructor/entity/entity.object.go new file mode 100644 index 0000000..3e454bb --- /dev/null +++ b/konstructor/entity/entity.object.go @@ -0,0 +1,12 @@ +package entity + +type ObjectType struct { + ID string + RenderOptions RenderOptions +} + +type Object struct { + ID string + Type ObjectType + Position Position +} diff --git a/konstructor/entity/entity.player.go b/konstructor/entity/entity.player.go new file mode 100644 index 0000000..2119557 --- /dev/null +++ b/konstructor/entity/entity.player.go @@ -0,0 +1,18 @@ +package entity + +type InventoryItem struct { + Item Item + Used bool + Active bool +} + +type Inventory struct { + Items []InventoryItem +} + +type Player struct { + ID string + RenderOptions RenderOptions + Position Position + Inventory Inventory +} diff --git a/konstructor/entity/entity.playground.go b/konstructor/entity/entity.playground.go index ec6bd57..41dd1bd 100644 --- a/konstructor/entity/entity.playground.go +++ b/konstructor/entity/entity.playground.go @@ -7,48 +7,10 @@ type Position struct { } type RenderOptions struct { - Image string - Width int - Height int -} - -type ObjectType struct { - ID string - RenderOptions RenderOptions -} - -type Object struct { - ID string - Type ObjectType - Position Position -} - -type NPCType struct { - ID string - RenderOptions RenderOptions -} - -type NPC struct { - ID string - Type NPCType - Position Position -} - -type Player struct { - ID string - RenderOptions RenderOptions - Position Position -} - -type ItemType struct { - ID string - RenderOptions RenderOptions -} - -type Item struct { - ID string - Type ItemType - Position Position + Image string + Width int + Height int + Visible bool } type Playground struct { diff --git a/konstructor/entity/entity.settings.go b/konstructor/entity/entity.settings.go index c651383..7c939b8 100644 --- a/konstructor/entity/entity.settings.go +++ b/konstructor/entity/entity.settings.go @@ -21,5 +21,5 @@ type ScreenSettings struct { type Settings struct { Name string Screen *ScreenSettings - KeyMap *KeyMap + KeyMap KeyMap } diff --git a/main.go b/main.go index cc9df33..bc53a24 100644 --- a/main.go +++ b/main.go @@ -33,7 +33,7 @@ func main() { Width: 640, Height: 480, }, - KeyMap: &entity.KeyMap{ + KeyMap: entity.KeyMap{ Up: ebiten.KeyUp, Down: ebiten.KeyDown, Right: ebiten.KeyRight,