Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pass a point to Display#set and move drawing out of other objects
- Loading branch information
Showing
6 changed files
with
21 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
class World | ||
constructor: (@dimensions) -> | ||
@map = new Map(@dimensions) | ||
@player = new Player(0,0) | ||
|
||
redraw: (x, y) -> @map.redraw x, y | ||
paint: (display) -> | ||
for row in [0...@dimensions.height] | ||
for col in [0...@dimensions.width] | ||
point = {x:col, y:row} | ||
display.set point, @charAt point | ||
|
||
charAt: (point) -> @map.charAt point | ||
isBlocked: (x, y) -> @map.isBlocked x, y | ||
|
||
@World = World |