Keep a ground-targeted spell inside its range and in front of walls
The player points at the floor for a fireball or a trap, but the cursor can be far away, right on the caster or behind a wall. Using it raw makes spells land where they should not. This entry shows how to pull the target in, push it out, and what to do when the cursor sits exactly on the caster.
Why this works
The player points at where they want it, and the game should give the nearest place that is allowed instead of saying no. Drawing the preview and casting at the same spot is what keeps the circle honest.
When not to use it
Skip it when exact aim is the skill, such as a puzzle of precise placement, or when a too-far cast should fail to punish a bad read. Then show the limit clearly and refuse the cast.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 4 common mistakes and the fix
- 29 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 "Keep a ground-targeted spell inside its range and in front of walls" (read_entry ground-spell-target-stays-in-range-and-before-walls) 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