NOT touching a kind

Hello everyone!

I am making a dinosaur game where you walk around and stomp buildings. The city is randomly generated, part of which I throw water sprites down. I want the player/monster to slow down while touching the water sprites.

I can easily set my variable of playerSpeed to whatever I want when it overlaps with the correct kind, but I can’t figure out how to speed it back to normal when it isn’t touching anymore.

I found the “mysprite overlaps with othersprite” block that I can put into an if/else and that works but only for one of the water sprites generated (I’m guessing the first or the last?) so I seem to need to work with the “overlaps with kind” blocks.

Here is my project. Sorry if it is a mess. https://makecode.com/_FD8WVu4UDR6t

3 Likes

You need to put the check into a for array of all sprites kind and replace othersprite with value. otherwise it will only check the last one created. Here is the fix implemented. The array of sprites kind block is under the sprites tab.

Fun game! Great job!

Thank you for your help. I totally get what is going on in the example fix you posted for me. However, it doesn’t seem to work. The dino doesn’t speed back up to 50. It looks like it should. /puzzle