Why is overlap not working?

im making a game about traffic signs fighting and while making my second character (a stop light) I came across a bug where sometimes the special move overlapping with the other player doesn’t work and I was wondering if anyone can help? https://arcade.makecode.com/S21908-12124-38352-85081

4 Likes

It might be because you have 6 forever loops, all trying to do actions at the same time.

Here’s an example, so you can see more or less what 'i’m refering to.

I’m pretty sure the overlapping event can only trigger if one of the sprite’s position is being updated. Maybe try using the <is Sprite touching Sprite?> predicate, because it should check if the sprites are touching regardless of if they are moving or not.

While I can’t seem to replicate this bug, I can tell you that there is a bug with the current sprite overlap code the should be fixed in the next Arcade release, though I don’t think your sprites fit the requirements to cause the bug, I could be wrong. Too many Forever loops is definitely not the issue, and the normal sprite overlaps block does still activate when both sprites are not moving. The only other thing I know of is that putting wait blocks inside sprite overlap blocks sometimes acts really weird, so maybe try switching to those “for (“action”)…” blocks?

Btw, that word “action” inside the “for (“action”) at most once every (ms) do…” block is for keeping track of the action that’s being timed, so unless you want the player 2 attacks to stop when player 1 shoots an attack, you should change that word to something else in every block. That also could be causing your issue, but I don’t think so.

This is a super fun idea for a game! I would love to play it when it’s done!

1 Like

I tried it and it didn’t work sadly