Advertisement
Guest User

Untitled

a guest
Jan 18th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. stage {
  2.     backdrop White("gallery:General/White")
  3.     let bouncing = false;
  4.     let gameOn = true;
  5.    
  6.     actor BeachBall {
  7.         costume Idle("gallery:Summer/Beach Ball Idle")
  8.         when stage.started {
  9.             this.physics.isCollides = true;
  10.             this.physics.isStatic = false;
  11.             this.physics.damping = 0.2;
  12.             stage.physics.disableWall("top");
  13.             this.size = 30;
  14.             this.physics.collisionShape = "polygon";
  15.             this.setPosition(0, -150);
  16.             this.show();
  17.             stage.physics.horizontalGravity = 0;
  18.             stage.physics.verticalGravity = 25;
  19.         }
  20.         when stage.keyPressed("right arrow") {
  21.             this.physics.applyForce(100, 90);
  22.         }
  23.         when stage.keyPressed("left arrow") {
  24.             this.physics.applyForce(100, -90);
  25.         }
  26.         when stage.keyPressed("space") {
  27.             if(!bouncing) {
  28.                 bouncing = true;
  29.                 this.physics.applyForce(400, 0);
  30.             }
  31.         }
  32.         when touched {
  33.             bouncing = false;
  34.         }
  35.         when stage.started {
  36.             while(!this.touching(Edge.top)) {
  37.                
  38.             }
  39.             this.hide();
  40.             gameOn = false;
  41.         }
  42.     }
  43.    
  44.     actor Board {
  45.         costume Board_Vertical("gallery:Objects/Board Horizontal")
  46.         when stage.started {
  47.             this.setPosition(340, 0);
  48.             this.heading = 90;
  49.             this.size = 150;
  50.             this.hide();
  51.             this.setPosition(Math.randomBetween(-300, 300), 220);
  52.             while(gameOn) {
  53.                 createClone(this);
  54.                 this.wait(3);
  55.                 if(200 < this.x) {
  56.                     this.x -= Math.randomBetween(120, 140);
  57.                 }
  58.                 else {
  59.                     if(this.x < -200) {
  60.                         this.x += Math.randomBetween(120, 140);
  61.                     }
  62.                     else {
  63.                         if(Math.randomBetween(0, 1) == 1) {
  64.                             this.x += Math.randomBetween(120, 170);
  65.                         }
  66.                         else {
  67.                             this.x -= Math.randomBetween(120, 170);
  68.                         }
  69.                     }
  70.                 }
  71.             }
  72.             this.deleteAllClones();
  73.         }
  74.         when cloned {
  75.             this.show();
  76.             this.physics.collisionShape = "polygon";
  77.             while(this.y > -200) {
  78.                 this.y -= 0.35;
  79.                 wait(0.01);
  80.             }
  81.             this.deleteClone();
  82.         }
  83.     }
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement