tilegame / TileExperiments

experiments with tiling systems for web games.
https://tilegame.github.io/TileExperiments/
0 stars 0 forks source link

Use iterator functions for drawing #1

Closed fractalbach closed 6 years ago

fractalbach commented 6 years ago

Separate the concept of WHEN you draw, from WHAT you draw...

For each Tile in VisibleTiles:  Draw(Tile)

For each {Object, Location} in Visible objects: 
    Draw(Object) at (Location)

... And have separate functions for determining things like "which players are visible" and "what dynamic objects should be drawn on the screen"

fractalbach commented 6 years ago

https://github.com/fractalbach/TileExperiments/blob/2dcb0fecbc0331dbfa7772ba9faff26dd1fbc076/js/camera.js#L38-L47