Moving objects with arrowKey
Posted: Thu Dec 22, 2011 11:49 pm
What is the best way to move an object around on a screen using the arrow keys? I tried this:
This will move a button upward on the screen, but you can't stop it from moving upward until it reaches its destination. I'd like the button to keep moving upward but stop when I release the up arrow. And then do the same thing with the down arrow. I know I can do something like this:
That works, but it looks absolutely terrible on the screen - it's jumpy movement. And if you go 1 instead of 10 it moves smooth but at a snail's pace.
Any suggestions? I'm in the Game Academy right now and I'll be posting a similar message there, but the aeMoveTo command is nice and smooth and I was hoping I could use it.
Code: Select all
on arrowKey whichKey
if whichKey is "up" then
aeMoveTo the long id of button "goodGuy", 134,69,5000
end if
end arrowKey
Code: Select all
on arrowKey whichKey
if whichKey is "up" then
set the top of button "goodGuy" to the top of button "goodGuy" - 10
end if
end arrowKey
Any suggestions? I'm in the Game Academy right now and I'll be posting a similar message there, but the aeMoveTo command is nice and smooth and I was hoping I could use it.