Spielerando

Make a sword hit each enemy once per swing, unless it should hit more

The blade stays inside an enemy for several frames, so one swing deals the damage three or four times. Fixing that is easy, but then moves meant to hit several times stop working. This entry handles both cases with one small record.

Why this works

A swing is one event in the player's mind, even though it lasts many moments on screen. Keeping a record of who this swing has already hurt ties the damage to the event, not to how long things overlap.

When not to use it

Skip it for things that are meant to hurt as long as you touch them, like a grinder, a laser beam or a patch of fire. Those need a steady rhythm of damage per source, not a record kept per swing.

In the full entry

  • What to build, step by step
  • Starting values and the reason for each
  • 3 common mistakes and the fix
  • 41 lines of example code with 4 checks that pass
  • How your AI shows you that it works

Say this to your AI

Use the Spielerando entry "Make a sword hit each enemy once per swing, unless it should hit more" (read_entry one-hit-per-swing-and-multi-hit-moves) in my game. Build it step by step, and show me how you checked that it works.

Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP