Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to make a sprite disappear when it hits the edge of the screen
- herbfairy__
-
New Scratcher
4 posts
How to make a sprite disappear when it hits the edge of the screen
Hi folks, I'm currently making a simple shooter game. At this point I'm struggling to figure out how to get the diamonds to disappear when they hit the bottom of the screen, (if they aren't hit with a rainbow) I've tried many different methods to no avail.
Also If anyone can explain how to make the ‘lives’ counter go down by one when a diamond escapes the rainbows and hits the bottom of the screen without it counting down infinitely. I hope that made sense.
See my project here: https://scratch.mit.edu/projects/416621787
Thank you for your time.
Also If anyone can explain how to make the ‘lives’ counter go down by one when a diamond escapes the rainbows and hits the bottom of the screen without it counting down infinitely. I hope that made sense.
See my project here: https://scratch.mit.edu/projects/416621787
Thank you for your time.
Last edited by herbfairy__ (Aug. 9, 2020 04:24:30)
- nerdiebirdy
-
Scratcher
500+ posts
How to make a sprite disappear when it hits the edge of the screen
The best way to do this would be to clone the diamonds. Put this in the diamond sprite:
when green flag clicked
hide
forever
create clone of [myself v]
wait [your number here] secs
end
when I start as a clone
show
go to x: (pick random (-240) to (240)) y: (180)
repeat until <touching [unicorn v]>
change y by [-1]
if <<touching [edge v]> and <(y position) = (-180)>> then
change [lives v] by (-1)
delete this clone
end
end
delete this clone
- herbfairy__
-
New Scratcher
4 posts
How to make a sprite disappear when it hits the edge of the screen
Thank you so much!
- hawksbillturtle
-
Scratcher
1 post
How to make a sprite disappear when it hits the edge of the screen
I need a way to make a ball disappear when they hit the bottom of the back round
- SparklePuppyPonyGirl
-
Scratcher
74 posts
How to make a sprite disappear when it hits the edge of the screen
if you want to make something dissapear, use these blocks:
first you go down to the “sensing” section of the blocks. Find the “if touching ____ ” block and set it to “if touching edge.” If it's a clone or there are copies of it, end the script by going to the “control” section of the blocks. Scroll down to the bottom and select “delete this clone.” If it's the only one, go up to the “looks” section of the blocks and select the “hide” block. Put it at the end of your script.
first you go down to the “sensing” section of the blocks. Find the “if touching ____ ” block and set it to “if touching edge.” If it's a clone or there are copies of it, end the script by going to the “control” section of the blocks. Scroll down to the bottom and select “delete this clone.” If it's the only one, go up to the “looks” section of the blocks and select the “hide” block. Put it at the end of your script.
- cIoudyness
-
Scratcher
500+ posts
How to make a sprite disappear when it hits the edge of the screen
my question is how a fourth grader has the patience to scroll down to page fifty something and find this
please don’t necropost - that’s posting on old forums and bringing them back up to the front
please don’t necropost - that’s posting on old forums and bringing them back up to the front
- Aneri9714
-
Scratcher
100+ posts
How to make a sprite disappear when it hits the edge of the screen
You can do this:
Whatever happens :: events hat
go to [random position v]
show
repeat until <touching [edge v] ?>
. . .
end
hide
delete this clone - only use this block if it is a clone :: control cap
- Mechanical_coding
-
Scratcher
44 posts
How to make a sprite disappear when it hits the edge of the screen
when @greenFlag clicked
forever
if <touching [edge v]>then
hide
- Discussion Forums
- » Help with Scripts
-
» How to make a sprite disappear when it hits the edge of the screen
