Newbie question. Simultaneous action and facing?
Posted: Wed May 19, 2010 1:07 am
Two quick questions.
How do I get the player movement, on the up and down keys, for example, and the associated ground movement to work simultaneously? Sort of like ...
doesn't work. Am I missing brackets to isolate each instruction before the "in 0.5 seconds" or something?
Second question. How do I make a button or image rotate at a variable speed (rotateSpeed) to always point at (track/watch) another image?
Thank you.
Code: Select all
on arrowKey theKey
// move player image
if theKey is "up" then move image "player" relative 0,-50 in 0.5 seconds
if theKey is "down" then move image "player" relative 0,50 in 0.5 seconds
if theKey is "left" then move image "player" relative -50,0 in 0.5 seconds
if theKey is "right" then move image "player" relative 50,0 in 0.5 seconds
// move ground slower in a parallax type movement
if theKey is "up" then move image "ground" relative 0,10 in 0.5 seconds
if theKey is "down" then move image "ground" relative 0,-10 in 0.5 seconds
end arrowKey
Code: Select all
on arrowKey theKey
// move player image
if theKey is "up" then move image "player" relative 0,-50 AND move image "ground" relative 0,10 in 0.5 seconds in 0.5 seconds
if theKey is "down" then move image "player" relative 0,50 AND AND move image "ground" relative 0,-10 in 0.5 seconds in 0.5 seconds
if theKey is "left" then move image "player" relative -50,0 in 0.5 seconds
if theKey is "right" then move image "player" relative 50,0 in 0.5 seconds
end arrowKey
Second question. How do I make a button or image rotate at a variable speed (rotateSpeed) to always point at (track/watch) another image?
Thank you.