Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- onClipEvent (load)
- {
- speed = 1;
- fallspeed = 0;
- Y = _y;
- faceleft = false;
- elasticness = 0.500000;
- quickness = 0.300000;
- OLDXSPEED = 0;
- OLDYSPEED = 0;
- shooting = false;
- Jumped = true;
- sinking = false;
- _root.reset = false;
- doone = false;
- }
- onClipEvent (enterFrame)
- {
- if(_root.reset == true){
- sinking = false;
- }
- if(this._y > 600){
- _root.reset = true;
- }
- if(_root.powerup2 == true){
- this.gotoAndPlay("powerup2");
- sinking = true;
- }
- if(_root.powerup == true){
- this.gotoAndPlay("powerup");
- sinking = true;
- }
- if(_root.powerup == false){
- poweredup = true;
- }
- if(poweredup == true){
- sinking = false;
- poweredup = false;
- }
- //var playSound = function(){
- // JumpSound = new Sound(this);
- //JumpSound.attachSound("wee.wav");
- //JumpSound.start(0, 0);
- // }
- //
- // sound1 = sound.attachSound("Wee.wav");
- //sound2 = sound.attachSound("Wee2.wav");
- //sound3 = sound.attachSound("Woho.wav");
- //sound4 = sound.attachSound("YeHaa.wav");
- //sound5 = sound.attachSound("Yup1.wav");
- //
- //if(doone == false){
- // nume = (random(5)+1);
- // doone = true;
- // }
- //
- //
- //trace(nume);
- // var sound:Sound = new Sound();
- // if(allreadyDone == false){
- // if(nume == 1){
- //_root.jumpSound = new Sound(this);
- //_root.jumpSound.attachSound("Wee.wav")
- //allreadyDone = true;
- // }
- // if(nume == 2){
- //_root.jumpSound = new Sound(this);
- //_root.jumpSound.attachSound("Wee.wav")
- //allreadyDone = true;
- //
- // }
- // if(nume == 3){
- //_root.jumpSound = new Sound(this);
- //_root.jumpSound.attachSound("Wee.wav")
- //allreadyDone = true;
- //
- // }
- // if(nume == 4){
- //_root.jumpSound = new Sound(this);
- //_root.jumpSound.attachSound("Wee.wav")
- //allreadyDone = true;
- //
- // }
- // if(nume == 5){
- //_root.jumpSound = new Sound(this);
- //_root.jumpSound.attachSound("Wee.wav")
- //allreadyDone = true;
- //
- // }
- //sound.start(0,0);
- // }
- //
- //
- if(_root.reset == true){
- this._x = _root.StartPoint._x;
- this._y = _root.StartPoint._y
- sinking = false;
- _root.reset = false;
- }
- if(this.hitTest(_root.rain)){
- sinking = true;
- this._x = _root.rain._x + 50;
- this._y = _root.rain._y +20;
- this.gotoAndPlay("Sink");
- }
- if(this.hitTest(_root.rain1)){
- sinking = true;
- this._x = _root.rain1._x + 50;
- this._y = _root.rain1._y +20;
- this.gotoAndPlay("Sink");
- }
- if(this.hitTest(_root.rain2)){
- sinking = true;
- this._x = _root.rain2._x + 50;
- this._y = _root.rain2._y +20;
- this.gotoAndPlay("Sink");
- }
- if(sinking == false){
- keydown = false;
- setProperty("", _x, _x + speed);
- setProperty("", _y, _y + fallspeed);
- if (!_root.ground.hitTest(_x, _y + 3, true) && !_root.holder.hitTest(_x, _y + 1, true))
- {
- if (faceleft == false)
- {
- this.gotoAndPlay("Jumping");
- this._xscale = 100;
- } // end if
- if (faceleft == true)
- {
- this.gotoAndPlay("Jumping");
- this._xscale = -100;
- Jumped = true;
- } // end if
- ++fallspeed;
- if (_root.ground.hitTest(_x - 10, _y, true) || _root.holder.hitTest(_x - 3, _y, true))
- {
- if (fallspeed > 0)
- {
- fallspeed = fallspeed - 0.500000;
- } // end if
- if(sinking == false){
- if (Key.isDown(38) || Key.isDown(_root.UP))
- {
- }
- playSound();
- Jumped = true;
- // fallspeed = -10;
- // speed = 5;
- _root.jumpSound = new Sound(this);
- _root.jumpSound.start();
- } // end if
- } // end if
- if (_root.ground.hitTest(_x + 10, _y, true) || _root.holder.hitTest(_x + 3, _y, true))
- {
- if (fallspeed > 0)
- {
- fallspeed = fallspeed - 0.500000;
- } // end if
- if(sinking == false){
- if (Key.isDown(38) || Key.isDown(_root.UP))
- {
- }
- playSound();
- Jumped = true;
- // fallspeed = -10;
- // speed = -5;
- } // end if
- } // end if
- if (Key.isDown(37) || Key.isDown(_root.LEFT))
- {
- speed = speed - (speed + 5) / 15;
- newSound();
- } // end if
- if (Key.isDown(39) || Key.isDown(_root.RIGHT))
- {
- speed = speed - (speed - 5) / 15;
- newSound();
- } // end if
- }
- else
- {
- if (fallspeed > 0)
- {
- } // end if
- fallspeed = 0;
- if (Key.isDown(38) || Key.isDown(_root.UP))
- {
- playSound();
- keydown = true;
- UP = true;
- fallspeed = -10;
- _root.jumpSound = new Sound(this);
- _root.jumpSound.attachSound("Wee.wav")
- } // end if
- if (Key.isDown(37) || Key.isDown(_root.LEFT))
- {
- this.gotoAndPlay("Running");
- keydown = true;
- this._xscale = -100;
- faceleft = true;
- speed = speed - (speed + 15) / 5;
- } // end if
- if (Key.isDown(39) || Key.isDown(_root.RIGHT))
- {
- keydown = true;
- faceleft = false;
- this.gotoAndPlay("Running");
- this._xscale = 100;
- speed = speed - (speed - 15) / 5;
- } // end if
- speed = speed * 0.700000;
- } // end else if
- if (keydown == false && shooting == false)
- {
- if (_root.ground.hitTest(_x, _y + 10, true) || _root.holder.hitTest(_x, _y + 10, true))
- {
- if(sinking == false){
- if(!Key.isDown(Key.RIGHT) or !Key.isDown(Key.LEFT)){
- if (faceleft == false)
- {
- this.gotoAndPlay("Idle");
- this._xscale = 100;
- } // end if
- if (faceleft == true)
- {
- this.gotoAndPlay("Idle");
- this._xscale = -100;
- } // end if
- }
- }
- if (Jumped == true)
- {
- _root.attachsmoke = true;
- Jumped = false;
- } // end if
- if (faceleft == false)
- {
- this.gotoAndPlay("Idle");
- this._xscale = 100;
- } // end if
- if (faceleft == true)
- {
- this.gotoAndPlay("Idle");
- this._xscale = -100;
- } // end if
- } // end if
- } // end if
- if (Key.isDown(32))
- {
- if (faceleft == false && shooting == false)
- {
- this.gotoAndPlay("Shooting");
- shooting = true;
- }
- else
- {
- this.gotoAndPlay("LIdle");
- } // end if
- } // end else if
- if (_root.ground.Bouncebox.hitTest(_x, _y + 10, true))
- {
- fallspeed = -20;
- } // end if
- if (_root.ground.RDiagonallyBox.hitTest(_x, _y + 10, true))
- {
- fallspeed = -20;
- speed = 5;
- } // end if
- if (_root.ground.LDiagonalBox.hitTest(_x, _y + 10, true))
- {
- fallspeed = fallspeed * -20;
- speed = -5;
- } // end if
- if (_root.ground.LeftBox.hitTest(_x - 10, _y, true))
- {
- speed = 10;
- } // end if
- if (_root.ground.RightBox.hitTest(_x + 10, _y, true))
- {
- speed = -10;
- } // end if
- while (_root.ground.hitTest(_x, _y + 1, true) || _root.holder.hitTest(_x, _y + 1, true))
- {
- hitbox = false;
- setProperty("", _y, --_y);
- setProperty("", _y, --_y);
- } // end while
- while (_root.ground.hitTest(_x, _y - 12, true) || _root.holder.hitTest(_x, _y - 40, true))
- {
- hitbox = false;
- setProperty("", _y, _y - 0.100000);
- setProperty("", _y, ++_y);
- setProperty("", _y, ++_y);
- } // end while
- while (_root.ground.hitTest(_x - 11, _y, true) || _root.holder.hitTest(_x - 11, _y, true))
- {
- setProperty("", _x, ++_x);
- setProperty("", _x, ++_x);
- } // end while
- while (_root.ground.hitTest(_x + 9, _y, true) || _root.holder.hitTest(_x + 9, _y, true))
- {
- setProperty("", _x, --_x);
- setProperty("", _x, --_x);
- } // end while
- if (_root.holder.hitTest(_x - 12, _y - _height / 2, true))
- {
- speed = 0;
- _root.char._x = _root.char._x - speed * 0.700000;
- setProperty("", _x, ++_x);
- setProperty("", _x, ++_x);
- hitbox = true;
- }
- else
- {
- hitbox = false;
- } // end else if
- if (_root.holder.hitTest(_x + 12, _y - _height / 2, true))
- {
- speed = 0;
- _root.char._x = _root.char._x - speed * 0.700000;
- setProperty("", _x, --_x);
- setProperty("", _x, --_x);
- hitbox = true;
- }
- else
- {
- hitbox = false;
- } // end else if
- if (hitbox == true)
- {
- speed = 0;
- } // end if
- }
- }
Add Comment
Please, Sign In to add comment