spacetea/simulator/player.go

30 lines
510 B
Go
Raw Normal View History

2022-05-17 23:29:59 -04:00
package simulator
2022-05-19 15:18:03 -04:00
import (
"fmt"
)
2022-05-17 23:29:59 -04:00
//Player is a player controlled mob
type Player struct {
2022-05-19 15:18:03 -04:00
Resources map[int]int
CurrentTile *Tile
2022-05-17 23:29:59 -04:00
}
//NewPlayer initializes a player
func NewPlayer() *Player {
return &Player{Resources: make(map[int]int)}
}
func (p *Player) String() string {
var res string
res += "Resources: \n"
for i := range p.Resources {
res += fmt.Sprintf("%v: %v", i, p.Resources[i])
}
2022-05-19 15:18:03 -04:00
res += "\nLocation: \n"
if p.CurrentTile != nil {
res += p.CurrentTile.String()
}
2022-05-17 23:29:59 -04:00
return res
}