all groups > flash (macromedia) > november 2005 >
You're in the

flash (macromedia)

group:

Moving objects in a game with keyboard



Moving objects in a game with keyboard Ultimara
11/16/2005 11:06:59 PM
flash (macromedia): I am making a game with just little circles, but i want them to do various
command via the keyboard, i know how i would access the commands using
actionscript, but i need to know how to make the happen using buttons on the
keyboard
Re: Moving objects in a game with keyboard gameMaker
11/17/2005 12:58:59 AM
Ultimara, try this:

Place this code on the movieclip you want to move.

On(keypress "a")
{
_x+=10
}

This will move the movieclip 10 pixles right everytime the a button is pressed

Flash will give you code hints to buttons like left and right arrows or the
enter key.

You can also put all the key functions on a single movieclip for multiple
objects.
on(keypress "1")
{

_root.ball._x+=10

}

on(keypress "2")
{

_root.ball._x-=10

}
Hope this helps

AddThis Social Bookmark Button