Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to end a game?
- sweet_sim
-
New Scratcher
10 posts
How to end a game?
I am making a game in which there is a clone of a sprite falling from different directions and there is a bowl sprite on the bottom to catch the muffin clones. I want to end the game when the muffin clone misses the bowl and want the score and a sprite saying good try in the end. How do I do this
- Nightseeker1
-
Scratcher
100+ posts
How to end a game?
when green flag clicked
hide
forever
wait (pick random (5) to (7)) secs
create clone of [myself v]
end
when I start as a clone
go to x: (pick random (-180) to (180)) y: (140)
show
forever
if <(dummy) = [1]> then
change y by (-5)
end
if <touching [guy v] ?> then
set [dummy v] to [1]
hide
end
if <touching [edge v] ?> then
stop [all v]
end
end
- amylaser
-
Scratcher
500+ posts
How to end a game?
Here's all the code you will need for the muffin sprite:
And then you can have a different sprite with a costume that says “Good try!” For that sprite, you will need this code:
Hope this helps!
when green flag clicked
hide variable [score v]
set [score v] to [0]
hide
forever
create clone of [myself v]
wait (1) secs
end
when I start as a clone
go to x: (pick random (-240) to (240)) y: (180)
show
repeat until <(y position) < [-180]>
change y by (-5) //change this number to change the speed
if <touching [bowl v] ?> then
change [score v] by (1)
hide
delete this clone
end
end
hide
broadcast [game over v]
when I receive [game over v]
stop [other scripts in sprite v]
delete this clone //this isn't really the best place to put this block of code, but oh well...
And then you can have a different sprite with a costume that says “Good try!” For that sprite, you will need this code:
when green flag clicked
hide
when I receive [game over v]
show
go to front
show variable [score v]
Hope this helps!

Last edited by amylaser (Sept. 5, 2016 21:49:41)
- sweet_sim
-
New Scratcher
10 posts
How to end a game?
thank you can u guys checkout out my game and help me fix the mistakes?
- HMIDY
-
New Scratcher
1 post
How to end a game?
okay guys i'm making a snake game and i don't know how to make it so when the snake touches each other he dies?
- cwknikhil15842
-
Scratcher
100+ posts
How to end a game?
Put this script into your muffin (make the when flag clicked a when I start as clone):

Put this script in your game over sprite:

Hopefully it works!
Put this script in your game over sprite:
Hopefully it works!
Last edited by cwknikhil15842 (March 11, 2021 04:45:13)
- ayyyyes10135
-
Scratcher
100+ posts
How to end a game?
Put this script into your muffin (make the when flag clicked a when I start as clone):
Put this script in your game over sprite:
Hopefully it works!
this is from 2016. please dont necropost
- ilovechicken1234567
-
Scratcher
1 post
How to end a game?
I AM making a game were you have to click on 3 rabbits to win but i dont know how to end the game 

- Discussion Forums
- » Help with Scripts
-
» How to end a game?
i need help