Code: Select all
on arrowkey pKey
if pKey = "left" then
set the left of button "buttonsubbb" to the left of button "buttonsubbb" -1
end if
if pKey = "right" then
set the right of button "buttonsubbb" to the right of button "buttonsubbb" +1
end if
if pKey = "up" then
move button "buttonsubbb" relative +1,-1
end if
if pKey = "down" then
move button "buttonsubbb" relative +1,+1
end if
end arrowkey
Code: Select all
local varA
local posX
local posY
on arrowKey sRudder
if sRudder is "left" then
put (varA -1) into varA
end if
if sRudder is "right" then
put (varA +1) into varA
end if
send animationPlease to me in 0
end arrowKey
on animationPlease
put item 1 of the loc of btn "sub" into posX
put item 2 of the loc of btn "sub" into posY
put (posX + varA) into posX
put (posY +varA) into posY
if (posX <30) then
put 30 into posX
--put 10 into varA
end if
if (posX >= 450) then
put 450 into posX
--put -10 into varA
end if
set the loc of btn "sub" to posX,posY
end animationPlease