Sprite overlap with lava dies

I have a student who’s sprite loses all their lives when it contact lava, instead of just 1 life. When I swap out the sprite for a smaller one, it doesn’t have the same issue. I’m pretty sure it’s got to do with the size of this sprite, but I can’t figure out how to get the sprite to respawn and only lose 1 life.

Thanks!

3 Likes

it probably is the size. I think the size of the sprite makes it contact multiple lava tiles.

3 Likes

This is what is happening. There might be a cleaner way to do this, but you could remove the life in an onGameUpdate block instead like so:

2 Likes

Thanks so much! This looks like a good place to start. I appreciate the idea, and I’ll go play with it.

1 Like

There is a problem with this. If the player overlaps more than 1 lava tile at once, then they will still lose >1 lives.

1 Like