Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. onClipEvent (load) {
  2.     yspeed = 0;
  3.     xspeed = 0;
  4.     wind = 0.00;
  5.     power = 5;
  6.     gravity = 0;
  7.     upconstant = 0.75;
  8.     friction = 0.99;
  9.     collected_coins = 0;
  10. }
  11. onClipEvent (enterFrame) {
  12.     if (Key.isDown(Key.LEFT)) {
  13.         xspeed = xspeed-power;
  14.         gravity = 0.8;
  15.     }
  16.     if (Key.isDown(Key.RIGHT)) {
  17.         xspeed = xspeed+power;
  18.         gravity = 0.8;
  19.     }
  20.     if (Key.isDown(Key.UP)) {
  21.         yspeed = yspeed-power*upconstant;
  22.         gravity = 0.8;
  23.     }
  24.     if (Key.isDown(Key.DOWN)) {
  25.         yspeed = yspeed+power*upconstant;
  26.         gravity = 0.8;
  27.     }
  28.     xspeed = (xspeed+wind)*friction;
  29.     yspeed = yspeed+gravity;
  30.     _y = _y+yspeed;
  31.     _x = _x+xspeed;
  32.     _rotation = _rotation+xspeed;
  33.     if (_root.wall.hitTest(_x, _y, true)) {
  34.         xspeed = 0;
  35.         yspeed = 0;
  36.         _x = 50;
  37.         _y = 50;
  38.         _root.score -= 2;
  39.         _root.lives -= 1;
  40.         if (_root.score<0) {
  41.             _root.score = 0;
  42.         }
  43.     }
  44.     if (_root.environment.hitTest(_x, _y, true)) {
  45.         xspeed = 0;
  46.         yspeed = 0;
  47.         _x = 50;
  48.         _y = 50;
  49.         _root.score -= 1;
  50.         _root.lives -= 1;
  51.         if (_root.score<0) {
  52.             _root.score = 0;
  53.         }
  54.         if (_root.lives = 0) {
  55.             _root.lives = 0;
  56.         }
  57.     }
  58.     if (_root.coin.hitTest(this.dude_hit)) {
  59.         _root.coin._x = Math.random()*400+50;
  60.         _root.coin._y = Math.random()*250+50;
  61.         _root.score++;
  62.         collected_coins++;
  63.     }
  64.        
  65.         _root.level1_text.text = 10-collected_coins+" more to go";
  66.         if (collected_coins == 10) {
  67.             _root.play();
  68.         }
  69.         if (_root.lives == 0) {
  70.             collected_coins = 0
  71.         }
  72.         _root.lives_text.text = _root.lives;
  73.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement