Skip to content

Instantly share code, notes, and snippets.

@lesliev
Created August 11, 2013 06:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lesliev/6203647 to your computer and use it in GitHub Desktop.
Save lesliev/6203647 to your computer and use it in GitHub Desktop.
How do you refer to @tileSize and @tile in the constructor there? They are undefined.
class MapGenerator
@tileSize: 20 # width and height of a tile
# should this be a power of 2 for WebGL TilingSprite?
@tile:
floor: 0 # clear floor that objects can move through
wall: 1 # wall, creating an obstacle
deadspace: -1
constructor: (width, height) ->
console.log(@tileSize)
console.log(@tile.deadspace)
mg = new MapGenerator(10,10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment