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

#1 2009-12-19 13:55:14

WeirdF
Scratcher
Registered: 2009-05-31
Posts: 1000+

How do I make one variable get bigger if another is smaller?

If you don't understand the title, then I'll give an example.

I want the variable 'A' to get smaller if the variable 'B' is bigger, and 'B' to get bigger if 'A' is smaller. So that if A is 10, B is 20, if A is 9, B is 21, if A is 11 B is 19, etc.

Is there any way to do this without scripting it like this:

If A = 10
Set B to 20

If A = 11
Set B to 19

If A = 5
Set B to 25

etc. ?

Thanks.

Last edited by WeirdF (2009-12-19 13:57:28)


http://i.cr3ation.co.uk/dl/s1/gif/847032b8a331def77529b6a0384db1fe_handfingers.gif

Offline

 

#2 2009-12-19 14:14:36

The-Whiz
Scratcher
Registered: 2007-07-09
Posts: 1000+

Re: How do I make one variable get bigger if another is smaller?

<forever>
<set{ b  }to( (( 30 <-> a ))
<end>

Offline

 

Board footer