Documentation ¶
Index ¶
- Variables
- type Map
- func (currentMap *Map) CheckOutOfBounds(futurePosX, futurePosY int) bool
- func (currentMap *Map) CheckTileIsSpecial(posX, posY int) SpecialTile
- func (currentMap *Map) CheckTileIsWalkable(futurePosX, futurePosY int) bool
- func (m *Map) Copy() *Map
- func (currentMap *Map) FindObjectToRemove(object *object.Object) error
- func (currentMap *Map) GenerateMapImage()
- func (currentMap *Map) GetMapImageSize() (float32, float32)
- func (currentMap *Map) GetMapSize() (mapRows, mapColumns int)
- func (currentMap *Map) GetNPCAtPosition(x, y int) *npc.Stats
- func (currentMap *Map) RemoveNPC(npcToRemove *npc.Stats) error
- type SpecialTile
Constants ¶
This section is empty.
Variables ¶
var ( NotSpecialTile = SpecialTile{"NA", coord.Coord{}, coord.Coord{}} Village = Map{ Name: "Village", MapTransitions: []SpecialTile{ {"MapTransition", coord.Coord{X: 49, Y: 16, Map: 0}, coord.Coord{X: 5, Y: 6, Map: 1}}, {"MapTransition", coord.Coord{X: 49, Y: 17, Map: 0}, coord.Coord{X: 5, Y: 6, Map: 1}}, {"MapTransition", coord.Coord{X: 49, Y: 18, Map: 0}, coord.Coord{X: 5, Y: 6, Map: 1}}, {"MapTransition", coord.Coord{X: 49, Y: 19, Map: 0}, coord.Coord{X: 5, Y: 6, Map: 1}}, }, } ToTheOldMine = Map{ Name: "To the Old Mine", MapTransitions: []SpecialTile{ {"MapTransition", coord.Coord{X: 0, Y: 7, Map: 1}, coord.Coord{X: 47, Y: 17, Map: 0}}, {"MapTransition", coord.Coord{X: 0, Y: 8, Map: 1}, coord.Coord{X: 47, Y: 17, Map: 0}}, {"MapTransition", coord.Coord{X: 0, Y: 9, Map: 1}, coord.Coord{X: 47, Y: 17, Map: 0}}, {"MapTransition", coord.Coord{X: 0, Y: 10, Map: 1}, coord.Coord{X: 47, Y: 17, Map: 0}}, {"MapTransition", coord.Coord{X: 63, Y: 0, Map: 1}, coord.Coord{X: 1, Y: 1, Map: 2}}, {"MapTransition", coord.Coord{X: 63, Y: 1, Map: 1}, coord.Coord{X: 1, Y: 1, Map: 2}}, }, } TheOldMine = Map{ Name: "The Old Mine", MapTransitions: []SpecialTile{ {"MapTransition", coord.Coord{X: 0, Y: 0, Map: 2}, coord.Coord{X: 63, Y: 2, Map: 1}}, }, } // Slice containing all the maps of the game. AllTheMaps = []Map{Village, ToTheOldMine, TheOldMine} )
Functions ¶
This section is empty.
Types ¶
type Map ¶
type Map struct { Name string NPCList []*npc.Stats ObjectList []*object.Object MapMatrix [][]uint16 MapTransitions []SpecialTile MapImage image.Image }
func (*Map) CheckOutOfBounds ¶
CheckOutOfBounds checks if x, y coordinates are out of map bounds.
func (*Map) CheckTileIsSpecial ¶
func (currentMap *Map) CheckTileIsSpecial(posX, posY int) SpecialTile
CheckTileIsSpecial checks if, for a given map, x,y coordinates are special If so, return the SpecialTile do deal with effect.
func (*Map) CheckTileIsWalkable ¶
CheckTileIsWalkable checks if, for a given map, x,y coordinates are considered walkable.
func (*Map) FindObjectToRemove ¶
FindObjectToRemove loops through the currentMap ObjectList and removes object *model.Object.
func (*Map) GenerateMapImage ¶
func (currentMap *Map) GenerateMapImage()
GenerateMapImage generates or regenerates the whole image from map tiles.
func (*Map) GetMapImageSize ¶
GetMapImageSize returns the image x and y size.
func (*Map) GetMapSize ¶
GetMapSize return number of rows and number of columns of a given map.
func (*Map) GetNPCAtPosition ¶
For a given NPCsOnCurrentMap, check if NPCs are located on x,y return nil if none or pointer to npc.