Make touching a spike hurt on a beat, and leaving and returning cannot dodge it
Standing in a hazard should hurt every so often, not on every frame. But a cooldown that restarts when you step out lets a player hop in and out, and one shared cooldown lets a second hazard hide behind the first. This entry keeps track per source.
Why this works
A danger is something the player can learn: it bites, then needs a moment. Giving each source its own wait that keeps running whether or not you stand in it means no trick of stepping out and in changes the rhythm, and one trap cannot hide another.
When not to use it
Skip it when touching a hazard should simply be deadly, such as a pit or a wall of fire, or when the player already gets a short safe time after any hit. Then one rule on the player is enough and simpler.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 3 common mistakes and the fix
- 22 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 touching a spike hurt on a beat, and leaving and returning cannot dodge it" (read_entry contact-damage-cooldown-per-source) 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