Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( CategoryList []Category HuntingKnife = Object{ Name: "Hunting knife", Category: "Weapon", Weight: 200, Stats: []ObjectStat{ { Name: "physicalDamage", Modifier: 2, }, }, CanvasPath: "static/knife.png", } BluntSword = Object{ Name: "Blunt sword", Category: "Weapon", Weight: 1500, Stats: []ObjectStat{ { Name: "physicalDamage", Modifier: 4, }, }, CanvasPath: "static/sword.png", } BareHands = Object{ Name: "Bare Hands", Category: "Weapon", Weight: 0, } )
Functions ¶
func CategoryExists ¶
CategoryExists checks if the given category exists in the CommonCategories slice.
func GenerateCategories ¶
func GenerateCategories(names, descriptions []string)
GenerateCategories creates all the categories based on the provided names and descriptions.
func InitializeCategories ¶
func InitializeCategories()
InitializeCategories initializes the categories with their names and descriptions.
Types ¶
type Category ¶
type Category struct { Name string // Category name. Description string // Description of the category. }
Category represents a common object category.
type Object ¶
type Object struct { Name string // Object name. Category string // Object category. Weight int // Object weight in grams InInventory bool // Is Object in inventory Equipped bool // Is Object equipped Coord coord.Coord // Object position Stats []ObjectStat // Object stats (e.g., strength, health, etc.). CanvasImage *canvas.Image // Object image CanvasPath string // Image path for Object }
Object represents an object with its properties.
func CreateObject ¶
CreateObject creates a copy of the given object and returns it. It also validates the category before creating the object.
func (*Object) DrawObject ¶
func (subject *Object) DrawObject(mapContainer *fyne.Container)
DrawObject displays an object's image on the mapContainer.
func (*Object) MoveObject ¶
MoveObject moves object's coordinates and updates image position on map.
func (*Object) RefreshObject ¶
func (subject *Object) RefreshObject()
RefreshObject allows to refresh Object Image in case it was removed (save/load).
type ObjectStat ¶
type ObjectStat struct { Name string // Stat name, e.g., "Strength", "Health", etc. Modifier int // Modifier value for the stat. }
ObjectStat represents a specific stat of an object.
func (*ObjectStat) Copy ¶
func (os *ObjectStat) Copy() ObjectStat