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

#1 2009-03-02 00:42:07

JWinters755
Scratcher
Registered: 2009-03-02
Posts: 3

How to end a game

Hello, my son and I are totally new to this and are doing a project. The game has a dog chasing a cat, you move the cat w/the arrow keys. We have that part figured out fine. Where it isn't working is that if the dog catches the cat the game is supposed to show a 3rd Game Over sprite and stop the first two sprites. We can't figure out how to make this happen. Here's what we did:
1. Created the 3rd sprite (game over). Have these blocks for it:
[blocks]
<when green flag clicked><hide><when I receive[ end]><show><stop all> [/blocks]

2. In the cat sprite blocks, created another stack block that is set up as:
[blocks]<when green flag clicked><if><touching[ sprite 2]><broadcast[end]and wait><else><wait until><touching[ sprite 2]>[/blocks]

This isn't working though. When the dog catches the cat, the game over sprite doesn't appear. In addition, I can continue to make the cat move with the arrow keys.

What are we doing wrong? Any help would be appreciated!

Offline

 

#2 2009-03-02 02:22:44

bart9032
Scratcher
Registered: 2008-06-16
Posts: 100+

Re: How to end a game

there is nothing wrong in the cat sprite but in the game over sprite it should be like this
[blocks]
<when green flag clicked>
<hide>
<when I receive[ end
<show>
<say[ game over.
<stop all>
[/blocks]
So you should
now have a working script.


Hi, my name is Bartholomew JoJo 'Bart' Simpson. Nice to meet you,
Actually, no I am not Bart Simpson. I am bart9032  cool

Offline

 

#3 2009-03-02 03:59:54

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: How to end a game

It would be helpful if you could Share your game to the web...it's a lot easier to debug if you can run it yourself.

A couple of general things about the Stop All block...you have to be careful that you give your "game over" sprite time to display before you stop everything.  I've made the mistake of having the Stop All block interfere with the final sequence of events.  This is particularly true with online projects where the Stop All block seems to run very quickly.

Also, certain things are NOT stopped by the Stop All block.  "When Key Pressed" hat blocks will still run, even after the Stop All block has run.


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#4 2009-03-02 09:41:06

JWinters755
Scratcher
Registered: 2009-03-02
Posts: 3

Re: How to end a game

Hi there, thanks for the replies. We tried your suggestions but still can't get the Game Over sprite to appear. I posted the game at http://scratch.mit.edu/projects/JWinters755/437580. Any advice would be helpful, thanks.

Offline

 

#5 2009-03-02 09:51:39

Ssbrawl700
Scratcher
Registered: 2009-02-11
Posts: 100+

Re: How to end a game

the reason it's not working is because the block that broadcasts "end" is not a forever if block. since its an "if" block it does it for the moment not forever. everyone makes that mistake  smile

Last edited by Ssbrawl700 (2009-03-02 10:01:24)


Can you beat the ever-so challenging Keyboard Khaos?

Offline

 

#6 2009-03-02 10:06:18

demosthenes
Retired Community Moderator
Registered: 2008-02-19
Posts: 1000+

Re: How to end a game

Ssbrawl700 wrote:

the reason it's not working is because the block that broadcasts "end" is not a forever if block. since its an "if" block it does it for the moment not forever. everyone makes that mistake  smile

SSBrawl700 is right you need a forever loop. Another idea for the game is for the cat to move faster than the dog.


I've taken a long hiatus, but I still visit sometimes. Give me some time to answer any messages you post on my projects!

Offline

 

#7 2009-03-02 18:15:06

JWinters755
Scratcher
Registered: 2009-03-02
Posts: 3

Re: How to end a game

Ssbrawl700 and demosthenes, thanks a million, that did it! We will now work on enhancing the game to make it better. This is great!

Offline

 

#8 2009-03-03 08:52:03

alanel
Scratcher
Registered: 2009-03-03
Posts: 4

Re: How to end a game

JWinters755 wrote:

Hi there, thanks for the replies. We tried your suggestions but still can't get the Game Over sprite to appear. I posted the game at http://scratch.mit.edu/projects/JWinters755/437580. Any advice would be helpful, thanks.

your posted game is very interesting, I'm watching it now.

Offline

 

#9 2009-03-29 06:48:01

tomgalaxyzoo
Scratcher
Registered: 2009-03-28
Posts: 100+

Re: How to end a game

im afraid i cant help you, web blocks just cant compare!!!!


<forever> Galaxy Zoo!
smile  smile  smile  smile  woof woof!  smile  sad  big_smile  yikes  wink  hmm  tongue  lol  mad  roll  cool

Offline

 

Board footer