In Undertale, almost all the projectiles are telegraphed by being spawned outside of where they can actually hit you. If you could only spawn attacks from outside the box, that would then target the heart then:
1) the heart can actually dodge it in a logical manner.
2) you, the player, would have to figure out what combination of projectiles will actually give the heart nowhere to run to, so you can actually hit it.