Posted By

Monferno on 05/15/10


Tagged


Versions (?)

Player Movement


 / Published in: ActionScript
 

  1. // Requires a Movie Clip with the instance name of 'player'
  2.  
  3. player.onEnterFrame = function() {
  4. if (Key.isDown(Key.LEFT)) {
  5. player._x = player._x - speed;
  6.  
  7. speedInc()
  8. } else if (Key.isDown(Key.RIGHT)) {
  9. player._x = player._x + speed;
  10.  
  11. speedInc()
  12. } else if (Key.isDown(Key.UP)) {
  13. player._y = player._y - speed;
  14.  
  15. speedInc()
  16. } else if (Key.isDown(Key.DOWN)) {
  17. player._y = player._y + speed;
  18.  
  19. speedInc()
  20. } else {
  21. speed = 5;
  22. }
  23. }

Report this snippet  

You need to login to post a comment.