Say the player is standing in fire and I want to handle damage taken using the local collision event listener setup for player. To do so: I can setup a switch on_fire=true
that is first set in the event.phase==“began” of the localCollision listener, and this can start a separate process in the gameLoop that assigns damage over time until on_fire=false is set in event.phase==“ended” of localCollision…that can indeed all work, but what if the fire goes out aka is deleted? event.phase==“ended” doesn’t proc when a physics body is deleted…is there a way to trigger the “ended” phase manually? What am I supposed to do here?
I can’t just cheat and set on_fire to false before any fire is deleted/extinguished. Cause if I have more than 1 fire happening it might turn off another existing fire u are standing in. Again I’m looking for the solution “with listeners” or whatever method I’m intended to be using here. The methods without listeners are known.
localPostCollision would seem to be the solution…but the fire is set to isSensor=true and isSensor will not function in collisions other than the began and ended phases of local/global collision.
Everything works if I just set isSensor=false …but then the fire object is literally kicking the player out of its aoe. Is there a way I can make a static/dynamic/kinematic whatever physics body that isn’t isSensor=true but doesn’t affect(at least not really) anything it touches like isSensor=true would?..cause that should work.
The solution is seemingly always just out of grasp.