Skip to content

Instantly share code, notes, and snippets.

@jashkenas
Forked from timcash/classTest.coffee
Created August 13, 2010 03: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 jashkenas/522201 to your computer and use it in GitHub Desktop.
Save jashkenas/522201 to your computer and use it in GitHub Desktop.
class Planet
constructor: (@name, @size, @x, @y) ->
@ships = {}
battle: ->
for p of @ships
damage = randint @ships[p]
add_ships: (player, amount) ->
if @ships[player]?
@ships[player] += amount
else
@ships[player] = amount
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment