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

#1 2009-04-21 14:12:32

lcb01
Scratcher
Registered: 2009-04-21
Posts: 4

Question From New Member

When a Variable gets to a certain number, how do you make something happen?
Thanks!

Offline

 

#2 2009-04-21 14:14:06

BoltBait
Scratcher
Registered: 2009-03-09
Posts: 1000+

Re: Question From New Member

Something like this...
[blocks]
<when green flag clicked>
<wait until> <( <{ MyVar }> <=> 5 )>
<broadcast[ DoSomething  }>
[/blocks]

Then, in the object that you want to react...

[blocks]
<when I receive[ DoSomething
[/blocks]
etc.

Last edited by BoltBait (2009-04-21 14:20:05)


Animated sigs must be banned!
http://boltbait.com/j.pnghttp://boltbait.com/s.pnghttp://boltbait.com/d.pnghttp://boltbait.com/a.pnghttp://boltbait.com/p.png

Offline

 

#3 2009-04-21 14:32:08

cheddargirl
Scratch Team
Registered: 2008-09-15
Posts: 1000+

Re: Question From New Member

You can also try something like this:
When Green Flag Pressed
      forever if (variable) = 5
          (insert whatever you want your sprite to do here)


http://i.imgur.com/8QRYx.png
Everything is better when you add a little cheddar, because when you have cheese your life is at ease  smile

Offline

 

#4 2009-04-21 14:57:26

lcb01
Scratcher
Registered: 2009-04-21
Posts: 4

Re: Question From New Member

Thanks a lot guys—you helped me with one of my upcoming games!
It's going to be called, "Cat Knight."
Thanks!

Offline

 

#5 2009-04-21 15:41:23

lcb01
Scratcher
Registered: 2009-04-21
Posts: 4

Re: Question From New Member

I have another question: "How do you make a Sprite accept a certain thing that is broadcasted when it is in a certain costume?"
Thanks!

Offline

 

#6 2009-04-22 10:35:28

cheddargirl
Scratch Team
Registered: 2008-09-15
Posts: 1000+

Re: Question From New Member

In the Looks block, there is a rounded block called (costume #), and this corresponds to the number of the costume next to each costume in the costume tag. Assume you the costume # is 7.

When I receive (broadcast)
      if (costume #) = 7
            (insert whatever you want your sprite to do here)


http://i.imgur.com/8QRYx.png
Everything is better when you add a little cheddar, because when you have cheese your life is at ease  smile

Offline

 

#7 2009-04-30 17:54:07

iab97
Scratcher
Registered: 2009-04-04
Posts: 100+

Re: Question From New Member

People are so nice on Scratch.


-iab97 One of my favorite quotes: "You can't direct the wind, but can adjust your sails." -Unknown

Offline

 

Board footer