Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Changing score when sprite reaches bottom of screen in game?
- mz2004a
-
2 posts
Changing score when sprite reaches bottom of screen in game?
Hi guys, I'm making a shooting game where my rocket sprite is at the bottom, shooting at incoming rocks from the top of the screen. I've got that all set up, but for some reason I can't figure out how to make the score go down -1 when a rock touches the bottom of the screen or if a rock touches the rocket sprite. Any ideas for a script for this?
- mz2004a
-
2 posts
Changing score when sprite reaches bottom of screen in game?
I shared my project so you can see my current scripts, it's “Untitled” in my profile. Please forgive any novice coding you see, I'm new to programming lol.
- ResExsention
-
1000+ posts
Changing score when sprite reaches bottom of screen in game?
Hm.
Try this. Put them in your rock. Also, make a sprite that is just a line, call it map_bottom, and align it to the bottom of the preview:
Let me know how it goes, and good luck!
P.S. you should adapt this code to your own needs, as copying it probably won't work…
Try this. Put them in your rock. Also, make a sprite that is just a line, call it map_bottom, and align it to the bottom of the preview:
Let me know how it goes, and good luck!
P.S. you should adapt this code to your own needs, as copying it probably won't work…
- --Explosion--
-
1000+ posts
Changing score when sprite reaches bottom of screen in game?
You can also test the y position of the sprite and then change the score if it's near the bottom, also make sure to put a wait until not y position < -240 at the bottom of the if statement
- Kraken_Games
-
100+ posts
Changing score when sprite reaches bottom of screen in game?
You can also test the y position of the sprite and then change the score if it's near the bottom, also make sure to put a wait until not y position < -240 at the bottom of the if statement
If the sprite is centered, y positions almost never go below 200 (Unless the sprite is huge) as the scratch canvas is 480 by 360 with 0, 0 being at the center.
I still think it would be a suitable solution though.
- Discussion Forums
- » Help with Scripts
-
» Changing score when sprite reaches bottom of screen in game?