Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Making a simple game and having issues with lives and ending.
- sloh03
-
5 posts
Making a simple game and having issues with lives and ending.
First attempt at this and I'm going a little crazy. Trying to make a simple game. Its similar to space shooter game. 3 lives to start and you have to shoot things falling from the sky for 1 pt each. When those things hit the bottom edge, a life is lost and when no more lives, the game should have a game over screen.
So I got things to disappear when they are shot and the score goes up by 1.
But I am having trouble with the lives. I made it so that if the falling objects hits the edge, 1 life is lost. However, when things are shot and turn invisible, they still “hit” the edge and decrease the lives. How do I get around this?
I think I want it say that if the object is showing and hitting the edge, then -1 life. But I can't seem to find the buttons. Is there a better way?
It's also going into negative lives and I can't get the game over to show up when lives = 0. I think I want to say when lives = 0, stop all. And when all is stopped, show game over Sprite?
So I got things to disappear when they are shot and the score goes up by 1.
But I am having trouble with the lives. I made it so that if the falling objects hits the edge, 1 life is lost. However, when things are shot and turn invisible, they still “hit” the edge and decrease the lives. How do I get around this?
I think I want it say that if the object is showing and hitting the edge, then -1 life. But I can't seem to find the buttons. Is there a better way?
It's also going into negative lives and I can't get the game over to show up when lives = 0. I think I want to say when lives = 0, stop all. And when all is stopped, show game over Sprite?
- awesome-llama
-
1000+ posts
Making a simple game and having issues with lives and ending.
With the falling objects, are you using clones? If so, just use the delete this clone block instead of the hide block. A hidden clone still exists.
If not, the alternative is to stop the scripts that move the sprite if it has been hidden.
If not, the alternative is to stop the scripts that move the sprite if it has been hidden.
- ThE_PiXeL_MasTeR
-
53 posts
Making a simple game and having issues with lives and ending.
Hi there, give the link to your game si o can fix and do something's for you!
for your lives make a variable called “lives” and when flag is clicked set them to 3, then for the ships add “when flag clicked if touching (your ground or colour) then broadcast lose lives,” then go back to the player and add “when i recieve lose lives change lives by -1, then if lives =0 then stop all then bradcast die.” after that go to the game over sprite and use,“when i recieve die then show and glide in 5 secs to x:0 and Y:0”
=========================================================================================
I really hoped this helped and if you want comment the link to your game on my pofile and i can fix somethings for you.


for your lives make a variable called “lives” and when flag is clicked set them to 3, then for the ships add “when flag clicked if touching (your ground or colour) then broadcast lose lives,” then go back to the player and add “when i recieve lose lives change lives by -1, then if lives =0 then stop all then bradcast die.” after that go to the game over sprite and use,“when i recieve die then show and glide in 5 secs to x:0 and Y:0”
=========================================================================================
I really hoped this helped and if you want comment the link to your game on my pofile and i can fix somethings for you.



- sloh03
-
5 posts
Making a simple game and having issues with lives and ending.
I was not using clones.
Here is the link url=https://scratch.mit.edu/projects/196360657/
Thank you for the feedback, I will try some more!
Here is the link url=https://scratch.mit.edu/projects/196360657/
Thank you for the feedback, I will try some more!
Last edited by sloh03 (Jan. 7, 2018 11:45:37)
- H4K
-
100+ posts
Making a simple game and having issues with lives and ending.
In the sprite “Taco” replace
stop [all v]with
stop [other scripts in sprite v]and add this to the sprite called “Crab”
hide
stop [all v]
when gf clicked
wait until <(Lives)<[0]>
stop [other scripts in sprite v]
- sloh03
-
5 posts
Making a simple game and having issues with lives and ending.
H4K, can you please explain why those changes are necessary? I tried it and doesn't seem much different.
- sloh03
-
5 posts
Making a simple game and having issues with lives and ending.
If not, the alternative is to stop the scripts that move the sprite if it has been hidden.
If I put in Stop this script, nothing falls from the sky again.
- deck26
-
1000+ posts
Making a simple game and having issues with lives and ending.
I would recommend not using glide - use move n steps in a loop. Then you can include the touch detection in the loop and tell the sprite to stop moving rather than just hiding it.
Another method would be to add a new costume which is only used when you hide the sprite. You can then tell when the sprite is hidden by checking the value of costume# and only knock off a life when the costume# isn't set to that value.
Another method would be to add a new costume which is only used when you hide the sprite. You can then tell when the sprite is hidden by checking the value of costume# and only knock off a life when the costume# isn't set to that value.
- eric060408
-
100+ posts
Making a simple game and having issues with lives and ending.
If you make a sprite and tell it to hide you can't see it but the program thinks it still is there. First attempt at this and I'm going a little crazy. Trying to make a simple game. Its similar to space shooter game. 3 lives to start and you have to shoot things falling from the sky for 1 pt each. When those things hit the bottom edge, a life is lost and when no more lives, the game should have a game over screen.
So I got things to disappear when they are shot and the score goes up by 1.
But I am having trouble with the lives. I made it so that if the falling objects hits the edge, 1 life is lost. However, when things are shot and turn invisible, they still “hit” the edge and decrease the lives. How do I get around this?
I think I want it say that if the object is showing and hitting the edge, then -1 life. But I can't seem to find the buttons. Is there a better way?
It's also going into negative lives and I can't get the game over to show up when lives = 0. I think I want to say when lives = 0, stop all. And when all is stopped, show game over Sprite?
- sloh03
-
5 posts
Making a simple game and having issues with lives and ending.
Thanks for all the help, everyone.
I ended up starting over and it worked out ok (until it gets to higher levels…not sure why..)
Here it is: https://scratch.mit.edu/projects/196486045/
Maybe someone can tell me why it stops working at higher levels??
I ended up starting over and it worked out ok (until it gets to higher levels…not sure why..)
Here it is: https://scratch.mit.edu/projects/196486045/
Maybe someone can tell me why it stops working at higher levels??
- Discussion Forums
- » Help with Scripts
-
» Making a simple game and having issues with lives and ending.