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

#1 2012-03-04 11:16:20

wjack2010
Scratcher
Registered: 2010-06-28
Posts: 100+

Make variable go down

How do I make a variable go down every second by 1?

Offline

 

#2 2012-03-04 11:40:19

joletole
Scratcher
Registered: 2011-02-20
Posts: 1000+

Re: Make variable go down

set
variable
to
#
forever
wait
1
secs
change
variable
by
1

Offline

 

#3 2012-03-04 11:42:20

joletole
Scratcher
Registered: 2011-02-20
Posts: 1000+

Re: Make variable go down

if
variable
=
0
switch to costume
dead

Offline

 

#4 2012-03-04 11:44:15

wjack2010
Scratcher
Registered: 2010-06-28
Posts: 100+

Re: Make variable go down

Doesn't work. You can't put variable in an if statement.

Offline

 

#5 2012-03-04 11:47:51

joletole
Scratcher
Registered: 2011-02-20
Posts: 1000+

Re: Make variable go down

wjack2010 wrote:

Doesn't work. You can't put variable in an if statement.

oh yeah, the if block is supposed to be a control block, then have a green block with the = sign.

Offline

 

#6 2012-03-04 11:49:50

wjack2010
Scratcher
Registered: 2010-06-28
Posts: 100+

Re: Make variable go down

So..:

when clicked
# + #

Offline

 

#7 2012-03-04 12:36:04

mattlai2
Scratcher
Registered: 2011-12-06
Posts: 100+

Re: Make variable go down

joletole wrote:

if
variable
=
0
switch to costume
dead

if
variable
=
0
switch to costume
dead

Offline

 

#8 2012-03-04 12:46:05

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: Make variable go down

joletole wrote:

set
variable
to
#
forever
wait
1
secs
change
variable
by
1

I think you mean:

set
variable
to
a number
forever
wait
1
secs
change
variable
by
-1

Last edited by Greenatic (2012-03-04 12:46:23)

Offline

 

#9 2012-03-04 13:06:25

wjack2010
Scratcher
Registered: 2010-06-28
Posts: 100+

Re: Make variable go down

How do I make it stop when it hits 0? Because it starts going -1, -2 lol

Offline

 

#10 2012-03-04 13:12:00

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Make variable go down

set
variable
to
15
for example
repeat until
variable
=
0
wait
1
secs
change
variable
by
-1

Offline

 

#11 2012-03-04 13:24:26

wjack2010
Scratcher
Registered: 2010-06-28
Posts: 100+

Re: Make variable go down

How do I make it stop when it hits 0? Because it starts going -1, -2 lol

Offline

 

#12 2012-03-04 13:40:06

funelephant
Scratcher
Registered: 2010-07-02
Posts: 1000+

Re: Make variable go down

scimonster wrote:

set
variable
to
15
for example
repeat until
variable
=
0
wait
1
secs
change
variable
by
-1
broadcast
end

Last edited by funelephant (2012-03-04 13:40:30)


nicki begs to differ
http://24.media.tumblr.com/ab0e6e8fd347c5e39c2821bcab9d16e6/tumblr_mgu35sui1L1rfb7aqo2_500.gif

Offline

 

#13 2012-03-04 19:23:26

a1130
Scratcher
Registered: 2009-08-27
Posts: 500+

Re: Make variable go down

scimonster wrote:

set
variable
to
15
for example
repeat until
variable
=
0
wait
1
secs
change
variable
by
-1

Fixed it a bit  smile

Offline

 

#14 2012-03-05 04:55:04

mattlai2
Scratcher
Registered: 2011-12-06
Posts: 100+

Re: Make variable go down

a1130 wrote:

scimonster wrote:

set
variable
to
15
for example
repeat until
variable
=
0
wait
1
secs
change
variable
by
-1

Fixed it a bit  smile

Fixed it a bit.  smile

Offline

 

#15 2012-03-05 19:44:48

JabberJay
New Scratcher
Registered: 2012-03-05
Posts: 75

Re: Make variable go down

when clicked
forever
wait
1
second
change
Name of Variable
by
1

Hope this works

Offline

 

#16 2012-03-05 19:53:17

imnotbob
Scratcher
Registered: 2010-12-11
Posts: 1000+

Re: Make variable go down

I think it would be "-1"


PesterChum Handle: annoyingAnchorman
durp yo terezi sup sup gotta beat john gotta beat john

Offline

 

#17 2012-03-05 20:07:32

JabberJay
New Scratcher
Registered: 2012-03-05
Posts: 75

Re: Make variable go down

imnotbob wrote:

I think it would be "-1"

Oh ya, oops.

Offline

 

#18 2012-03-06 14:53:04

turkey3
Scratcher
Registered: 2011-12-04
Posts: 500+

Re: Make variable go down

joletole wrote:

set
variable
to
#
forever
wait
1
secs
change
variable
by
1

Do this but since you want ime counting down change it by -1

Offline

 

#19 2012-03-06 21:17:28

a1130
Scratcher
Registered: 2009-08-27
Posts: 500+

Re: Make variable go down

mattlai2 wrote:

a1130 wrote:

scimonster wrote:

set
variable
to
15
for example
repeat until
variable
=
0
wait
1
secs
change
variable
by
-1

Fixed it a bit  smile

Fixed it a bit.  smile

Oops, sorry  tongue

Offline

 

Board footer