-
-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
Hi,
this is possibly a dumb question, but I'm not getting it yet :) Let's say I define grid this way:
type Cell struct {
sprite string
}
grid := tile.NewGridOf[Cell](width, height)When iterating over the grid, like this:
grid.Each(func(point tile.Point, t tile.Tile[Cell]) {
// t.Value() returns an int16 which is 0 in all tiles, no Cell ???
})Of course I can create another map of cells like this:
cells := make(map[tile.Point]Cell, width*height)
grid.Each(func(point tile.Point, t tile.Tile[Cell]) {
cells[point] = &Cell{"...."}
})But that way I'd have two grids, the one provided by the tile module and my "shadow" grid holding the cell data (where I'd put things like sprites, properties etc).
What am I doing wrong?
Thanks in advance,
Tom
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels