This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-05-12 14:26:15

NickLush
New Scratcher
Registered: 2012-05-12
Posts: 2

How do I end the game?

This is my first time using Scratch.  I followed a sample script for a game called 'Shark Attack' found at:

http://www.teach-ict.com/ks3/year7/game_generation/Scratch%20Guide%20-%20Shark%20Attack%20Game.pdf

The regular fish are worth one point, the bonus fish 10 points and the octopus resets your points to zero.  I want to have the game end at 13 points - there are 3 fish plus the bonus fish - preferably with a 'You win!' message. How can I do this?

Thanks for your help!

Offline

 

#2 2012-05-12 17:48:10

turkey3
Scratcher
Registered: 2011-12-04
Posts: 500+

Re: How do I end the game?

If the game ends at a certain amount of points, I would suggest this, and you would make a sprite that says "You Win!" this script would go in this sprite

When gf clicked
Hide
Wait until <(points) = [amount to win]>
Show
Stop all
What this does is hides the sprite when the green flg is clicked, waits for the score to reach the limit, then the "You Win!" sprite pops up and te game entirely ends. When you create the sprite on te left you'll see a "T". Click on it and type the text. Font size and stow is also changeable.

Last edited by turkey3 (2012-05-12 17:50:26)

Offline

 

#3 2012-05-13 17:33:40

SOScratch
Scratcher
Registered: 2010-02-01
Posts: 100+

Re: How do I end the game?

Oh, this is easy!
Just follow these steps:

First you will need to make a variable called "Points."
Make the variable show to all sprites.
Make it and then input this script into the shark sprite:

when gf clicked
forever
if <touching [fish v]?>
change [points v] by (1)
end
if <touching [bonus fish v]?>
change [points v] by (10)
end
if <(points) = (13)>
broadcast [You Win! v]
stop all
end
I assume you have all the other scripts on the other sprites there.
So with that said...
Go to the stage and make a YOU WIN background.
Just add some color and text that reads "YOU WIN" or something like that.

Then go to the stage and put in these two scripts:

when gf clicked
switch to background [underwater v]
when I receive [You Win! v]
switch to background [win v]
Questions?
Just ask!

Last edited by SOScratch (2012-05-13 17:34:39)


-SOScratch
Scratch On!

Offline

 

#4 2012-05-14 06:23:59

fetchydog567
Scratcher
Registered: 2011-12-28
Posts: 500+

Re: How do I end the game?

Easy!

when gf clicked
if <<touching [fish v]>or<<touching [fish2 v]>or<touching [fish3 v]>>>
 change [score v] by (1)
end
if <touching [bonus fish v]>
 change [score v] by (10)
end
if <touching [octopus v]>
 set [score v] to (0)
end
if <(score) = [13]>
 say [You win!] for (2) secs
 stop all
end

Last edited by fetchydog567 (2012-05-14 06:27:24)


http://www.minecraftanonymous.com/assets/banners/banner_51.pngJust a reminder I won't be on Scratch that much but I 'll still be here, so if i'm on something, I will be commenting back, okay! wink , PICO Team!!!!!!!!!!! SCRATCH DEADW!!! PICO HACK ACCOUTNTT@@

Offline

 

#5 2012-05-15 09:12:44

jontmy00
Scratcher
Registered: 2011-11-28
Posts: 1000+

Re: How do I end the game?

fetchydog567 wrote:

Easy!

when gf clicked
if <(score) > [12]>
 say [You win!] for (2) secs
 stop all
else
if <<touching [fish v] ?>or<<touching [fish2 v] ?>or<touching [fish3 v] ?>>>
 change [score v] by (1)
end
if <touching [bonus fish v] ?>
 change [score v] by (10)
end
if <touching [octopus v] ?>
 set [score v] to (0)
end
end

Fixed and improved.  big_smile

Last edited by jontmy00 (2012-05-15 09:13:30)


FOR ALL THE NEWS ON UPDATES FOR SIMPLISTICRAFT, CLICK HERE.

Offline

 

#6 2012-05-15 09:55:40

TorbyFork234
Scratcher
Registered: 2012-03-01
Posts: 1000+

Re: How do I end the game?

jontmy00 wrote:

fetchydog567 wrote:

Easy!

when gf clicked
forever
if <(score) > [12]>
 say [You win!] for (2) secs
 stop all
else
if <<touching [fish v] ?>or<<touching [fish2 v] ?>or<touching [fish3 v] ?>>>
 change [score v] by (1)
wait until <not<<touching [fish v] ?>or<<touching [fish2 v] ?>or<touching [fish3 v] ?>>>>
end
if <touching [bonus fish v] ?>
 change [score v] by (10)
wait until <not<touching [bonus fish v] ?>>
end
if <touching [octopus v] ?>
 set [score v] to (0)
wait until <not<touching [octupus v]?>>
end
end

Fixed and improved.  big_smile

Improved the scripts.

Offline

 

#7 2012-05-15 20:12:36

NickLush
New Scratcher
Registered: 2012-05-12
Posts: 2

Re: How do I end the game?

Thank you all very much for your help!

Offline

 

#8 2012-05-15 21:00:05

darkblade525
Scratcher
Registered: 2012-01-29
Posts: 34

Re: How do I end the game?

[Offtopic]YOU CANT END THE GAME[/offtopic]


http://dl.dropbox.com/u/77821642/Reboundlogo.png

Offline

 

#9 2012-05-16 04:04:45

jontmy00
Scratcher
Registered: 2011-11-28
Posts: 1000+

Re: How do I end the game?

darkblade525 wrote:

[Offtopic]YOU CANT END THE GAME[/offtopic]

You can if you know how to...  wink


FOR ALL THE NEWS ON UPDATES FOR SIMPLISTICRAFT, CLICK HERE.

Offline

 

Board footer