Created
December 11, 2015 00:02
-
-
Save franksands/a9f2ba3d0b6b25a8df61 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
public class LivingThing() { | |
// ...other code in the class... | |
public void takeDamage(int amount) { | |
this.health = this.health - amount; | |
if (this.health <= 0) { | |
print(this.name + " is dead!"); | |
} | |
} | |
} | |
hero = LivingThing("Elsa", 50, 80, "Axe"); | |
hero.takeDamage(10) // Elsa takes 10 points of damage |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment