Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stop();
- function addChar(){
- char = this.attachMovie("char", "char",_root.getNextHighestDepth());
- char._x = 300;
- char._y = 200;
- }
- addChar();
- function addPickup(){
- pickup = this.attachMovie("pickup","pickup",_root.getNextHighestDepth());
- pickup._x = random(400);
- pickup._y = random(300);
- }
- addPickup();
- function addScore(){
- ScoreUp = this.attachMovie("ScoreUp","ScoreUp",_root.getNextHighestDepth());
- ScoreUp._x = 120;
- ScoreUp._y = 250;
- }
- function addtrail(){
- trail = this.attachMovie("trail","trail",_root.getNextHighestDepth());
- trail._x = char._x;
- trail._y = char._y;
- }
- function addblock(){
- block = this.attachMovie("block","block",_root.getNextHighestDepth());
- block._x = 203;
- block._y = 132;
- }
- function addblock2(){
- block = this.attachMovie("block2","block2",_root.getNextHighestDepth());
- block._x = 483;
- block._y = 60;
- }
- addblock2();
- addblock();
- score = 0;
- xSpeed = 0;
- ySpeed = 0;
- CurrentSpeed = 5;
- alive = true
- char.onEnterFrame = function(){
- if(alive){
- addtrail();
- this._x += xSpeed;
- this._y += ySpeed;
- if(Key.isDown(Key.RIGHT)){
- xSpeed = CurrentSpeed;
- ySpeed = 0;
- }else if(Key.isDown(Key.LEFT)){
- xSpeed = -CurrentSpeed;
- ySpeed = 0;
- }if(Key.isDown(Key.UP)){
- ySpeed = -CurrentSpeed;
- xSpeed = 0;
- }else if(Key.isDown(Key.DOWN)){
- ySpeed = CurrentSpeed;
- xSpeed = 0;
- }if(this._x > 520){
- xSpeed = -CurrentSpeed;
- }if(this._x < 25){
- xSpeed = CurrentSpeed;
- }if(this._y < 25){
- ySpeed = CurrentSpeed;
- }if(this._y > 320){
- ySpeed = -CurrentSpeed;
- }if(this.hitTest(pickup)){
- addScore();
- removeMovieClip(pickup);
- addPickup();
- CurrentSpeed += 0.1;
- score +=5;
- }
- }
- }
- movingUp = true;
- block.onEnterFrame = function(){
- if(this._y < 79 && movingUp){
- movingUp = false;
- }else if(this._y > 267){
- movingUp = true;
- }if(movingUp){
- this._y --;
- }else if(!movingUp){
- this._y ++;
- }if(char.hitTest(this)){
- alive = false
- gotoAndStop(3);
- removeMovieClip(pickup);
- removeMovieClip(char);
- removeMovieClip(block);
- removeMovieClip(block2);
- removeMovieClip(trail)
- }
- }
- movingUp2 = true;
- block2.onEnterFrame = function(){
- if(this._x < 60 && movingUp2){
- movingUp2 = false;
- }else if(this._x > 483){
- movingUp2 = true;
- }if(movingUp2){
- this._x --;
- }else if(!movingUp2){
- this._x ++;
- }if(char.hitTest(this)){
- alive = false
- gotoAndStop(3);
- removeMovieClip(pickup);
- removeMovieClip(char);
- removeMovieClip(block2);
- removeMovieClip(block);
- removeMovieClip(trail)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement