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

#1 2011-12-12 08:19:13

Whizzkids_ie
New Scratcher
Registered: 2011-12-06
Posts: 3

Question about Variables

Hi all,
I have a quick (and what I hope is basic) question.  I'm working on a game at the moment where presents have escaped and Santa is trying to collect them.  The Grinch is floating around the screen trying to hinder dear Santa.  You get one score for every present you collect and the game is over if you bump into the Grinch, so I've created a variable called "score" which increases by one per present.

I would like to make the game harder as you play.  When the score gets to 20, I would like a second Grinch to appear.  This is what I have used and it's not working:
[blocks]
<when green flag clicked><forever if><(  <{SCORE}><=> 20<broadcast[ SECOND GRINCH )>
[/blocks]
So the script for the second grinch looks like this:
[blocks]
<when green flag clicked><hide>
<when I receive[ SECOND GRINCH]><show>
[/blocks]

Any suggestions would be great - thanks

Offline

 

#2 2011-12-12 09:50:44

kayybee
Scratcher
Registered: 2009-12-07
Posts: 1000+

Re: Question about Variables

Try instead of using a forever if, use a "wait until". It's at the bottom of control.

Offline

 

#3 2011-12-12 10:06:17

rabbit1131
Scratcher
Registered: 2009-10-16
Posts: 1000+

Re: Question about Variables

Hrmph... Maybe you could upload the project? Or a picture?
The forum block BBcode needs work. I can't really understand the code  hmm


The Intergalactic Adventures of Revesilia! I hope you will partake in this gigantic undertaking, to build the sequel to the hit map The Adventures of Revesilia! The Intergalactic Adventures of Revesilia Map Builders Application thread! http://internetometer.com/image/35004.png

Offline

 

#4 2011-12-12 10:36:27

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: Question about Variables

The scripts you posted seen alright, so maybe check that there isn't another counterracting script somewhere else?  wink


Why

Offline

 

#5 2011-12-13 06:17:28

Whizzkids_ie
New Scratcher
Registered: 2011-12-06
Posts: 3

Re: Question about Variables

Sorry about that Rabbit - it was my first time trying to use the blocks in a post so I'm surprised anyone was able to make any kind of sense of them. 

Kayybee - perfect suggestion - worked a treat.

Thanks for all your help guys.

Offline

 

#6 2011-12-13 19:16:08

kayybee
Scratcher
Registered: 2009-12-07
Posts: 1000+

Re: Question about Variables

no problem  smile

Offline

 

#7 2011-12-14 10:08:29

PaperMario123
Scratcher
Registered: 2011-11-25
Posts: 500+

Re: Question about Variables

If you done with this and want to close this topic, just Report the first post, and say, "I'm done- please close" or something, so the Scratch team/ moderators get a note saying you want to close.


http://i.picasion.com/pic46/52268c4a041cced4c8ed97cc7468f869.gif

Offline

 

Board footer