Skip to content

Instantly share code, notes, and snippets.

@tim-smart
Forked from timcash/planet2.coffee
Created August 13, 2010 06:53
Show Gist options
  • Save tim-smart/522442 to your computer and use it in GitHub Desktop.
Save tim-smart/522442 to your computer and use it in GitHub Desktop.
class Planet
constructor: (@name,@size,@x,@y) ->
@ships = {}
@damage_pool = {}
add_ships: (player,amount) ->
#add ships to an array based on the player who owns them
log("adding #{amount} ships to player #{player}")
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