Pages: 1
Topic closed
Hi guys, I'm sure this had been addressed plenty of times, but I can't find the solution in any forums I've looked through.
So... I'm trying to make an Asteroids style game, and need to have a variable turn on (switched to the number "1") for as long as the button is held down, then turning the variable back to off (the number 0) once the button is released.
Thanks in advance
Offline
Thanks for the fast reply,
I actually was looking for a key held down, not the mouse button. I found a solution shortly after posting.
I just put it in a:
When 'up key' pressed:
Forever:
If <up arrow pressed>
move 10 steps
</if>
</forever>
-------------------
Thanks!
Offline
[When green flag pressed]
[forever]
[if <key [up arrow] pressed>]
[][(insert block here)]
[endif]
[endforever]
Offline
Shouldn't this be better suited in All about scratch? Maybe?
Offline
GraemeK wrote:
This would actually be better as the script is only actually running when the up arrow key is pressed.
http://scratchr.webs.com/images/ifup.gif
It is less efficient because that control has a short delay when detecting.
Offline
HydraRancher wrote:
GraemeK wrote:
This would actually be better as the script is only actually running when the up arrow key is pressed.
http://scratchr.webs.com/images/ifup.gifIt is less efficient because that control has a short delay when detecting.
Well then simply put it in a
[blocks]
<when green flag clicked>
[/blocks]
block.
Offline
Topic closed
Pages: 1