Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. var gravity:Number = 0;
  2. speed = 10;
  3. scale = _xscale;
  4. left = 0;
  5. right = 0;
  6.  
  7.  
  8. onEnterFrame = function(){
  9. placeholder._y -= gravity;
  10. gravity -= 2;
  11.  
  12. if(gravity >= 25){
  13. gravity = 25
  14. }
  15.  
  16. if (Key.isDown(Key.LEFT)) {
  17. left = 1;
  18. }
  19.  
  20. if (left == 1 && placeholder.hitTest(_root.wall2) != true ) {
  21. placeholder._x -= speed;
  22. placeholder.gotoAndStop(2);
  23. _xscale = -scale;
  24. }
  25.  
  26. if (Key.isDown(Key.RIGHT)) {
  27. right = 1;
  28. }
  29.  
  30. if (right == 1 && placeholder.hitTest(_root.wall1) != true ) {
  31. placeholder._x += speed;
  32. placeholder.gotoAndStop(2);
  33. _xscale = +scale;
  34. }
  35.  
  36. if (right == 1 && left == 1) {
  37. placeholder.gotoAndStop(1);
  38. left = 0;
  39. right = 0;
  40. }
  41.  
  42. if(placeholder.hitTest(_root.floor1)){
  43. _y = 240;
  44. }
  45. else if(placeholder.hitTest(_root.floor2)){
  46. _y = 159;
  47. }
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54. else{
  55. if(Key.isDown(Key.SPACE)){
  56. _root.gravity = -10
  57.  
  58. }
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement