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

#1 2011-10-08 02:45:51

storm-is-coming
New Scratcher
Registered: 2011-07-05
Posts: 1

how to make something change when a variable raises/drops ?

i am trying to make a basic operating system and would like to know how i can make a sprite appear when another sprite is clicked on. one way i figured out is to make a variable and then when a sprite is clicked on it puts the variable to (for eg) 1. when the variable is at one it triggers another sprite to appear. if you understand this or would like more info please comment.
if you know another way i can do this please tell  smile

Offline

 

#2 2011-10-08 03:06:50

ssss
Scratcher
Registered: 2007-07-29
Posts: 1000+

Re: how to make something change when a variable raises/drops ?

I understand what you want, but it seems pretty simple.  Are you sure you've explained it properly?


Hey.  It's me SSSS, back from the dead!  smile

Offline

 

#3 2011-10-08 03:54:23

rookwood101
Scratcher
Registered: 2011-07-29
Posts: 500+

Re: how to make something change when a variable raises/drops ?

<when[ clickdetectorsprite ]clicked>
<broadcast[ please appear other sprite ]


http://i.imgur.com/zeIZW.png

Offline

 

#4 2011-10-08 06:21:12

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

Re: how to make something change when a variable raises/drops ?

storm-is-coming wrote:

i am trying to make a basic operating system and would like to know how i can make a sprite appear when another sprite is clicked on. one way i figured out is to make a variable and then when a sprite is clicked on it puts the variable to (for eg) 1. when the variable is at one it triggers another sprite to appear. if you understand this or would like more info please comment.
if you know another way i can do this please tell  smile

Another method is to use broadcast messages.  Broadcast messages are designed to do just what you are describing...let one sprite communicate with one or more other sprites. 

On the first sprite

[blocks]
<when[ First Sprite ]clicked>
<broadcast[ Make Second Sprite Appear
[/blocks]

On the second sprite

[blocks]
<when green flag clicked>
<hide>

<when I receive[ Make Second Sprite Appear
<show>
[/blocks]

You make up the broadcast message names to whatever you like that makes sense.


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

Offline

 

Board footer