Click the circle below to activate it and use arrow keys to move it around.
Download source project t1075.zip (3 kb)
function moveobject()
{
if(Key.isDown(Key.RIGHT)){
Sprite1._x = Sprite1._x + 5;
}
if(Key.isDown(Key.LEFT)){
Sprite1._x = Sprite1._x - 5;
}
if(Key.isDown(Key.UP)){
Sprite1._y = Sprite1._y - 5;
}
if(Key.isDown(Key.DOWN)){
Sprite1._y = Sprite1._y + 5;
}
}
setInterval(moveobject,50);
setInterval causes the Frame to execute the "moveobject" function every 50 milliseconds. The "moveobject" function checks if one of the arrow keys is pressed and then moves the Sprite1 object accordingly.