Discuss Scratch

clmariek
New Scratcher
3 posts

How to end the game once out of lives?

Hi there, not much experience and I'm making this for an assignment. The goal was to make a mini game of cat and mouse where you gain points by shooting projectiles but each time the mouse hits the floor, you lose a life. I want the game to end at the end of three lives but so far every code I've tried has just messed the game up. Not sure what I'm doing wrong. Any help is greatly appreciated.

Link to the game: https://scratch.mit.edu/projects/542589091
Deivos
Scratcher
62 posts

How to end the game once out of lives?

Are you allowed to ask for help on this assignment? If yes, basically you make a variable called life, set it to three when green flag clicked. Each time a mouse hits the floor you take away one from variable life, and make a forever if variable life = 0 broadcast end(end message so you can show an ending page or something) stop all. This is the most basic type, there are ones that are a tiny bit more complicated but I think you can go with this.
Thingied
Scratcher
1000+ posts

How to end the game once out of lives?

Set the “Lives” variable to whatever you want and if it's less than 1 stop everything.

Change the script for clones in “Mouse1” to this:

Using an extension so just ignore the dark theme.
Deivos
Scratcher
62 posts

How to end the game once out of lives?

Thingied wrote:

Set the “Lives” variable to whatever you want and if it's less than 1 stop everything.

Change the script for clones in “Mouse1” to this:

Using an extension so just ignore the dark theme.
Are you using ******* ***-***? That's what I use

Last edited by Deivos (June 9, 2021 22:45:38)

Thingied
Scratcher
1000+ posts

How to end the game once out of lives?

Deivos wrote:

Thingied wrote:

Set the “Lives” variable to whatever you want and if it's less than 1 stop everything.
-snip-
Change the script for clones in “Mouse1” to this:
-snip
Using an extension so just ignore the dark theme.
Are you using (removed) That's what I use
Don't name extensions ;-;

Last edited by Thingied (June 9, 2021 23:23:16)

Deivos
Scratcher
62 posts

How to end the game once out of lives?

Thingied wrote:

Deivos wrote:

Thingied wrote:

Set the “Lives” variable to whatever you want and if it's less than 1 stop everything.
-snip-
Change the script for clones in “Mouse1” to this:
-snip
Using an extension so just ignore the dark theme.
Are you using scratch add-ons? That's what I use
Don't name extensions ;-;
wait is it illegal
Thingied
Scratcher
1000+ posts

How to end the game once out of lives?

Deivos wrote:

wait is it illegal
https://scratch.mit.edu/discuss/topic/284272/
clmariek
New Scratcher
3 posts

How to end the game once out of lives?

Deivos wrote:

Are you allowed to ask for help on this assignment? If yes, basically you make a variable called life, set it to three when green flag clicked. Each time a mouse hits the floor you take away one from variable life, and make a forever if variable life = 0 broadcast end(end message so you can show an ending page or something) stop all. This is the most basic type, there are ones that are a tiny bit more complicated but I think you can go with this.
Thanks for the advice! Also, yes I was allowed to ask for help; they just want us to get an understanding of how coding works.
clmariek
New Scratcher
3 posts

How to end the game once out of lives?

Thingied wrote:

Set the “Lives” variable to whatever you want and if it's less than 1 stop everything.

Change the script for clones in “Mouse1” to this:

Using an extension so just ignore the dark theme.

Thank you! I kept trying to add the stop all code to mouse 1. I think that's why it wasn't working.

Powered by DjangoBB