From Game Editor
Revision as of 10:45, 29 June 2009 by Skydereign (Talk | contribs)
In gameEditor, there are several ways to achieve movement of an actor. Which method to use depends on what you prefer and factors such as sliding. If you want to move only when a key is pressed, you would probably manipulate x or y.
- x and y manipulation
- xvelocity yvelocity
- MoveTo
- Other
One Dimensional Movement
With simple movement, back and forth with no sliding,the easiest would be to use math equations to set x or y. An example, in the Draw event of an actor;
player -> Draw -> Script Editor
char * key = GetKeyState();
if(key[KEY_RIGHT]==1)
{
x+=5;
}
if(key[KEY_LEFT]==1)
{
x-=5;
}
This can also be done by using separate events, keydown right and keydown left, then using script to insert x+=5;, and x-=5;. As shown in the example, this method changes the x value. In these cases, x is increased by a small amount each frame, since the event is ongoing.
Will Continue Later

![[]](/wiki/skins/blender/open.png)