carbontwelve / roguelikedev2019

My attempt at learning roguelike gamedev in 2019
MIT License
2 stars 0 forks source link

Refactor Game Map #19

Closed carbontwelve closed 5 years ago

carbontwelve commented 5 years ago

Currently the game map is stored as an array of Tiles. Ideally the game map could be a [w*h]rune structure with each tile type having its own character: walls #, doors +, floors . etc. Those tile types can be defined as constants and allow us to write a renderer for ASCII as well as one for graphics mode. This unhooks the rendering functionality from the map structure.

const (
    MAP_SOLID_WALL = '#'
    MAP_VOID       = '.'
    ENTITY_PLAYER  = '@'
    ENTITY_DOOR    = '+'
)

Or as boohu does it here as a map[rune]string:

var MapNames = map[rune]string{
    '#':  "wall",
    '.':  "ground",
    '@':  "player",
}