/ Published in: ActionScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// Requires a Movie Clip with the instance name of 'player' player.onEnterFrame = function() { if (Key.isDown(Key.LEFT)) { player._x = player._x - speed; speedInc() } else if (Key.isDown(Key.RIGHT)) { player._x = player._x + speed; speedInc() } else if (Key.isDown(Key.UP)) { player._y = player._y - speed; speedInc() } else if (Key.isDown(Key.DOWN)) { player._y = player._y + speed; speedInc() } else { speed = 5; } }