Guest User

Untitled

a guest
Apr 20th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. onClipEvent (load)
  2. {
  3.     speed = 1;
  4.     fallspeed = 0;
  5.     Y = _y;
  6.     faceleft = false;
  7.     elasticness = 0.500000;
  8.     quickness = 0.300000;
  9.     OLDXSPEED = 0;
  10.     OLDYSPEED = 0;
  11.     shooting = false;
  12.     Jumped = true;
  13.     sinking = false;
  14.     _root.reset = false;
  15.     doone = false;
  16.  
  17. }
  18. onClipEvent (enterFrame)
  19.  
  20. {
  21.     if(_root.reset == true){
  22.                 sinking = false;
  23.                
  24.  
  25.     }
  26.     if(this._y > 600){
  27.         _root.reset = true;
  28.     }
  29.     if(_root.powerup2 == true){
  30.         this.gotoAndPlay("powerup2");
  31.         sinking = true;
  32.        
  33.    
  34.     }
  35.  
  36.     if(_root.powerup == true){
  37.         this.gotoAndPlay("powerup");
  38.         sinking = true;
  39.        
  40.     }
  41.     if(_root.powerup == false){
  42.         poweredup = true;
  43.        
  44.     }
  45.     if(poweredup == true){
  46.                 sinking = false;
  47.  
  48.                 poweredup = false;
  49.     }
  50.    
  51.     //var playSound = function(){
  52. //      JumpSound = new Sound(this);
  53. //JumpSound.attachSound("wee.wav");
  54. //JumpSound.start(0, 0);
  55. //  }
  56. // 
  57. //  sound1 = sound.attachSound("Wee.wav")
  58. //sound2 = sound.attachSound("Wee2.wav");
  59. //sound3 = sound.attachSound("Woho.wav");
  60. //sound4 = sound.attachSound("YeHaa.wav");
  61. //sound5 = sound.attachSound("Yup1.wav");
  62. //
  63. //if(doone == false){
  64. //       nume = (random(5)+1);
  65. //       doone = true;
  66. // }
  67. //
  68. //
  69. //trace(nume);
  70. //   var sound:Sound = new Sound();
  71. //     if(allreadyDone == false){
  72. //    if(nume == 1){
  73. //_root.jumpSound = new Sound(this);
  74. //_root.jumpSound.attachSound("Wee.wav")
  75. //allreadyDone = true;
  76. //    }
  77. //    if(nume == 2){
  78. //_root.jumpSound = new Sound(this);
  79. //_root.jumpSound.attachSound("Wee.wav")
  80. //allreadyDone = true;
  81. //
  82. //    }
  83. //    if(nume == 3){
  84. //_root.jumpSound = new Sound(this);
  85. //_root.jumpSound.attachSound("Wee.wav")
  86. //allreadyDone = true;
  87. //
  88. //    }
  89. //    if(nume == 4){
  90. //_root.jumpSound = new Sound(this);
  91. //_root.jumpSound.attachSound("Wee.wav")
  92. //allreadyDone = true;
  93. //
  94. //    }
  95. //    if(nume == 5){
  96. //_root.jumpSound = new Sound(this);
  97. //_root.jumpSound.attachSound("Wee.wav")
  98. //allreadyDone = true;
  99. //
  100. //    }
  101. //sound.start(0,0);
  102. //     }
  103. // 
  104. //
  105.  
  106.                
  107.     if(_root.reset == true){
  108.         this._x = _root.StartPoint._x;
  109.                 this._y = _root.StartPoint._y
  110.                 sinking = false;
  111.                 _root.reset = false;
  112.     }
  113.  
  114.    
  115.     if(this.hitTest(_root.rain)){
  116.         sinking = true;
  117.         this._x = _root.rain._x + 50;
  118.         this._y = _root.rain._y +20;
  119.        this.gotoAndPlay("Sink");
  120.        }
  121.        if(this.hitTest(_root.rain1)){
  122.         sinking = true;
  123.         this._x = _root.rain1._x + 50;
  124.         this._y = _root.rain1._y +20;
  125.        this.gotoAndPlay("Sink");
  126.        }
  127.         if(this.hitTest(_root.rain2)){
  128.         sinking = true;
  129.         this._x = _root.rain2._x + 50;
  130.         this._y = _root.rain2._y +20;
  131.        this.gotoAndPlay("Sink");
  132.        }
  133.        if(sinking == false){
  134.        
  135.        
  136.     keydown = false;
  137.     setProperty("", _x, _x + speed);
  138.     setProperty("", _y, _y + fallspeed);
  139.     if (!_root.ground.hitTest(_x, _y + 3, true) && !_root.holder.hitTest(_x, _y + 1, true))
  140.     {
  141.         if (faceleft == false)
  142.         {
  143.             this.gotoAndPlay("Jumping");
  144.             this._xscale = 100;
  145.         } // end if
  146.         if (faceleft == true)
  147.         {
  148.             this.gotoAndPlay("Jumping");
  149.             this._xscale = -100;
  150.             Jumped = true;
  151.         } // end if
  152.         ++fallspeed;
  153.         if (_root.ground.hitTest(_x - 10, _y, true) || _root.holder.hitTest(_x - 3, _y, true))
  154.         {
  155.             if (fallspeed > 0)
  156.             {
  157.                 fallspeed = fallspeed - 0.500000;
  158.             } // end if
  159.                    if(sinking == false){
  160.  
  161.             if (Key.isDown(38) || Key.isDown(_root.UP))
  162.             {
  163.                
  164.             }
  165.                             playSound();
  166.  
  167.                 Jumped = true;
  168.                // fallspeed = -10;
  169. //                speed = 5;
  170.                 _root.jumpSound = new Sound(this);
  171. _root.jumpSound.start();
  172.             } // end if
  173.         } // end if
  174.         if (_root.ground.hitTest(_x + 10, _y, true) || _root.holder.hitTest(_x + 3, _y, true))
  175.         {
  176.             if (fallspeed > 0)
  177.             {
  178.                 fallspeed = fallspeed - 0.500000;
  179.             } // end if
  180.                                if(sinking == false){
  181.  
  182.             if (Key.isDown(38) || Key.isDown(_root.UP))
  183.             {
  184.             }
  185.             playSound();
  186.                 Jumped = true;
  187.                // fallspeed = -10;
  188. //                speed = -5;
  189.             } // end if
  190.         } // end if
  191.        
  192.        
  193.         if (Key.isDown(37) || Key.isDown(_root.LEFT))
  194.         {
  195.             speed = speed - (speed + 5) / 15;
  196.                             newSound();
  197.  
  198.         } // end if
  199.         if (Key.isDown(39) || Key.isDown(_root.RIGHT))
  200.         {
  201.             speed = speed - (speed - 5) / 15;
  202.                             newSound();
  203.  
  204.         } // end if
  205.     }
  206.     else
  207.     {
  208.         if (fallspeed > 0)
  209.         {
  210.         } // end if
  211.         fallspeed = 0;
  212.         if (Key.isDown(38) || Key.isDown(_root.UP))
  213.         {
  214.                         playSound();
  215.  
  216.             keydown = true;
  217.             UP = true;
  218.             fallspeed = -10;
  219.                 _root.jumpSound = new Sound(this);
  220. _root.jumpSound.attachSound("Wee.wav")
  221.  
  222.         } // end if
  223.         if (Key.isDown(37) || Key.isDown(_root.LEFT))
  224.         {
  225.             this.gotoAndPlay("Running");
  226.             keydown = true;
  227.             this._xscale = -100;
  228.             faceleft = true;
  229.             speed = speed - (speed + 15) / 5;
  230.         } // end if
  231.         if (Key.isDown(39) || Key.isDown(_root.RIGHT))
  232.         {
  233.             keydown = true;
  234.             faceleft = false;
  235.             this.gotoAndPlay("Running");
  236.             this._xscale = 100;
  237.             speed = speed - (speed - 15) / 5;
  238.         } // end if
  239.         speed = speed * 0.700000;
  240.     } // end else if
  241.     if (keydown == false && shooting == false)
  242.     {
  243.         if (_root.ground.hitTest(_x, _y + 10, true) || _root.holder.hitTest(_x, _y + 10, true))
  244.         {
  245.             if(sinking == false){
  246.                 if(!Key.isDown(Key.RIGHT) or !Key.isDown(Key.LEFT)){
  247.                      if (faceleft == false)
  248.             {
  249.                 this.gotoAndPlay("Idle");
  250.                 this._xscale = 100;
  251.             } // end if
  252.             if (faceleft == true)
  253.             {
  254.                 this.gotoAndPlay("Idle");
  255.                 this._xscale = -100;
  256.             } // end if
  257.                 }
  258.             }
  259.        
  260.             if (Jumped == true)
  261.             {
  262.                 _root.attachsmoke = true;
  263.                 Jumped = false;
  264.             } // end if
  265.             if (faceleft == false)
  266.             {
  267.                 this.gotoAndPlay("Idle");
  268.                 this._xscale = 100;
  269.             } // end if
  270.             if (faceleft == true)
  271.             {
  272.                 this.gotoAndPlay("Idle");
  273.                 this._xscale = -100;
  274.             } // end if
  275.         } // end if
  276.     } // end if
  277.     if (Key.isDown(32))
  278.     {
  279.         if (faceleft == false && shooting == false)
  280.         {
  281.             this.gotoAndPlay("Shooting");
  282.             shooting = true;
  283.         }
  284.         else
  285.         {
  286.             this.gotoAndPlay("LIdle");
  287.         } // end if
  288.     } // end else if
  289.     if (_root.ground.Bouncebox.hitTest(_x, _y + 10, true))
  290.     {
  291.         fallspeed = -20;
  292.     } // end if
  293.     if (_root.ground.RDiagonallyBox.hitTest(_x, _y + 10, true))
  294.     {
  295.         fallspeed = -20;
  296.         speed = 5;
  297.     } // end if
  298.     if (_root.ground.LDiagonalBox.hitTest(_x, _y + 10, true))
  299.     {
  300.         fallspeed = fallspeed * -20;
  301.         speed = -5;
  302.     } // end if
  303.     if (_root.ground.LeftBox.hitTest(_x - 10, _y, true))
  304.     {
  305.         speed = 10;
  306.     } // end if
  307.     if (_root.ground.RightBox.hitTest(_x + 10, _y, true))
  308.     {
  309.         speed = -10;
  310.     } // end if
  311.     while (_root.ground.hitTest(_x, _y + 1, true) || _root.holder.hitTest(_x, _y + 1, true))
  312.     {
  313.         hitbox = false;
  314.         setProperty("", _y, --_y);
  315.         setProperty("", _y, --_y);
  316.     } // end while
  317.     while (_root.ground.hitTest(_x, _y - 12, true) || _root.holder.hitTest(_x, _y - 40, true))
  318.     {
  319.         hitbox = false;
  320.         setProperty("", _y, _y - 0.100000);
  321.         setProperty("", _y, ++_y);
  322.         setProperty("", _y, ++_y);
  323.     } // end while
  324.     while (_root.ground.hitTest(_x - 11, _y, true) || _root.holder.hitTest(_x - 11, _y, true))
  325.     {
  326.         setProperty("", _x, ++_x);
  327.         setProperty("", _x, ++_x);
  328.     } // end while
  329.     while (_root.ground.hitTest(_x + 9, _y, true) || _root.holder.hitTest(_x + 9, _y, true))
  330.     {
  331.         setProperty("", _x, --_x);
  332.         setProperty("", _x, --_x);
  333.     } // end while
  334.     if (_root.holder.hitTest(_x - 12, _y - _height / 2, true))
  335.     {
  336.         speed = 0;
  337.         _root.char._x = _root.char._x - speed * 0.700000;
  338.         setProperty("", _x, ++_x);
  339.         setProperty("", _x, ++_x);
  340.         hitbox = true;
  341.     }
  342.     else
  343.     {
  344.         hitbox = false;
  345.     } // end else if
  346.     if (_root.holder.hitTest(_x + 12, _y - _height / 2, true))
  347.     {
  348.         speed = 0;
  349.         _root.char._x = _root.char._x - speed * 0.700000;
  350.         setProperty("", _x, --_x);
  351.         setProperty("", _x, --_x);
  352.         hitbox = true;
  353.     }
  354.     else
  355.     {
  356.         hitbox = false;
  357.     } // end else if
  358.     if (hitbox == true)
  359.     {
  360.         speed = 0;
  361.     } // end if
  362. }
  363. }
Add Comment
Please, Sign In to add comment