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

#1 2012-02-04 00:38:23

kostersevgili
New Scratcher
Registered: 2012-02-04
Posts: 4

move when button pressed stop when button is let go.

What i want to o is for a cart to move up a tower. the key will be the up arrow. i want it to be is if the button is let go the cart stops moving. anyone know how to do this?

Offline

 

#2 2012-02-04 01:14:19

trinary
Scratcher
Registered: 2012-01-29
Posts: 1000+

Re: move when button pressed stop when button is let go.

when [up arrow v] key pressed
repeat until <not <[up arrow v]  key pressed?> >
change y by (1) //or whatever else you want it to do
end


http://trinary.tk/images/signature_.php

Offline

 

#3 2012-02-04 09:48:16

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

Re: move when button pressed stop when button is let go.

when green flag clicked
forever
  if <key [up arrow v] pressed?>
    change y by [3]
  end
end


Why

Offline

 

#4 2012-02-04 10:01:09

JSO
Community Moderator
Registered: 2007-06-23
Posts: 1000+

Re: move when button pressed stop when button is let go.

I think RedRocker227's solution will work fine.

trinary's script might act a bit weird, because it will starts over and over again (just like you type multiple A's when you hold the A key)


http://oi48.tinypic.com/2v1q0e9.jpg

Offline

 

#5 2012-02-04 12:09:33

kostersevgili
New Scratcher
Registered: 2012-02-04
Posts: 4

Re: move when button pressed stop when button is let go.

Thanks! it worked!

Offline

 

#6 2012-02-04 12:17:38

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

Re: move when button pressed stop when button is let go.

No problem  smile


Why

Offline

 

Board footer