Give Them Moves

STEP 2 — Give Them Moves

Because two characters staring at each other is not a game… it’s awkward.

We add two abilities:


Attack

The classic “bonk the enemy.”

def attack(attacker, target):
    damage = attacker["attack"]
    target["health"] -= damage
    print(attacker["name"], "hits", target["name"], "for", damage)

Explanation:

  • We look up the attacker’s attack power
  • Subtract it from the target’s health
  • Print a dramatic battle message

This is the moment your characters stop being peaceful citizens and start being chaos gremlins.

Engine ready! Paste attack code here.

Heal

The “snack break” move.

def heal(player):
    player["health"] += 20
    print(player["name"], "heals +20")

Explanation:
Healing is just adding health back.
It’s like giving your hero a magical juice box

Engine ready! Paste heal code here.