I have a melee attack that on collision with the enemies hitbox will subtract 1 from their health variable. But whenever I swing the -1 happens every tick that the attack box is inside the enemy hitbox. I'm not sure what I'm doing wrong here.
Hey there, the problem come from line 15, "Animation frame = 2" will trigger the action every tick as long as player frame =2, you need to add "Trigger Once" condition to avoid this
You can also add "Object -> On frame changed" so that the action runs every time Frame 2 is drawn (Trigger Once will only run the action once)
Develop games in your browser. Powerful, performant & highly capable.
The trigger once method works the same, as it first check if frame = 2, then check if trigger once, so as soon frame is changed and go back to frame 2, it will trigger the same way that On frame changed, so both works
Tomycase brushfe Thanks, adding the trigger once did the trick! I knew it had to be some easy fix that I just wasn't seeing.