Skip to content

Instantly share code, notes, and snippets.

@hasyimibhar
Created April 25, 2013 04:27
Show Gist options
  • Save hasyimibhar/5457499 to your computer and use it in GitHub Desktop.
Save hasyimibhar/5457499 to your computer and use it in GitHub Desktop.
void take_damage(
const Enemy *enemy,
int damage) {
assert(enemy != NULL && "enemy must not be NULL!");
assert(damage > 0 && "damage must be more than 0!");
enemy->health -= damage;
if (enemy->health <= 0) {
// Do whatever a dead enemy should be doing
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment