Skip to content

Instantly share code, notes, and snippets.

@franksands
Created December 11, 2015 00:02
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 franksands/a9f2ba3d0b6b25a8df61 to your computer and use it in GitHub Desktop.
Save franksands/a9f2ba3d0b6b25a8df61 to your computer and use it in GitHub Desktop.
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