Created
August 13, 2010 03:11
-
-
Save timcash/522200 to your computer and use it in GitHub Desktop.
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
class Planet | |
constructor: (@name,@size,@x,@y) -> | |
# I want an empty object to store ship in later | |
@ships = {} | |
battle: -> | |
#if more then one player has ships at this planet run the battle simulation | |
for p of @ships | |
damage = randint(@ships[p]) | |
# todo, remove ships based on damage here | |
add_ships: (player,amount) -> | |
#add ships to an array based on the player how owns them | |
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