Revision as of 09:37, 27 July 2019 by Jammum (talk | contribs) (Undo revision 232080 by Giga404 (talk) Unnecessary.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This tutorial explains how one can make a game or interactive animation with the arrow keys.

X-Y Method

This is the easiest way to do this. First, go to the sprite you want to make move. Then add these scripts:

when [up arrow v] key pressed
change y by (10)
when [down arrow v] key pressed
change y by (-10)
when [right arrow v] key pressed
change x by (10)
when [left arrow v] key pressed
change x by (-10)

Now, the sprite will stay in one direction while it moves around.

Steps Method

Using these scripts, the sprite will turn around while it moves. This is not recommended in a sprite that must turn for other reasons.

when [up arrow v] key pressed
point in direction (0 v)
move (10) steps
when [down arrow v] key pressed
point in direction (180 v)
move (10) steps
when [right arrow v] key pressed
point in direction (90 v)
move (10) steps
when [left arrow v] key pressed
point in direction (-90 v)
move (10) steps

Now your sprite will turn when it moves.

Other Steps Method

The Other Steps Method is the same as the Steps Method (above), but is faster, and offers the ability to use multiple keys at once.

when gf clicked
forever
if <key [right arrow v] pressed> then
point in direction (90 v)
move (10) steps
end
if <key [left arrow v] pressed> then
point in direction (-90 v)
move (10) steps
end
if <key [up arrow v] pressed> then
point in direction (0 v)
move (10) steps
end
if <key [down arrow v] pressed> then
point in direction (180 v)
move (10) steps
end
end

Quicker Speed Method

This method results in extra speed and the ability to use multiple keys at once.

when gf clicked
forever
if <key [left arrow v] pressed> then
change x by (-10)
end
if <key [right arrow v] pressed> then
change x by (10)
end
if <key [up arrow v] pressed> then
change y by (10)
end
if <key [down arrow v] pressed> then
change y by (-10)
end


end