Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stage {
- backdrop White("gallery:General/White")
- let bouncing = false;
- let gameOn = true;
- actor BeachBall {
- costume Idle("gallery:Summer/Beach Ball Idle")
- when stage.started {
- this.physics.isCollides = true;
- this.physics.isStatic = false;
- this.physics.damping = 0.2;
- stage.physics.disableWall("top");
- this.size = 30;
- this.physics.collisionShape = "polygon";
- this.setPosition(0, -150);
- this.show();
- stage.physics.horizontalGravity = 0;
- stage.physics.verticalGravity = 25;
- }
- when stage.keyPressed("right arrow") {
- this.physics.applyForce(100, 90);
- }
- when stage.keyPressed("left arrow") {
- this.physics.applyForce(100, -90);
- }
- when stage.keyPressed("space") {
- if(!bouncing) {
- bouncing = true;
- this.physics.applyForce(400, 0);
- }
- }
- when touched {
- bouncing = false;
- }
- when stage.started {
- while(!this.touching(Edge.top)) {
- }
- this.hide();
- gameOn = false;
- }
- }
- actor Board {
- costume Board_Vertical("gallery:Objects/Board Horizontal")
- when stage.started {
- this.setPosition(340, 0);
- this.heading = 90;
- this.size = 150;
- this.hide();
- this.setPosition(Math.randomBetween(-300, 300), 220);
- while(gameOn) {
- createClone(this);
- this.wait(3);
- if(200 < this.x) {
- this.x -= Math.randomBetween(120, 140);
- }
- else {
- if(this.x < -200) {
- this.x += Math.randomBetween(120, 140);
- }
- else {
- if(Math.randomBetween(0, 1) == 1) {
- this.x += Math.randomBetween(120, 170);
- }
- else {
- this.x -= Math.randomBetween(120, 170);
- }
- }
- }
- }
- this.deleteAllClones();
- }
- when cloned {
- this.show();
- this.physics.collisionShape = "polygon";
- while(this.y > -200) {
- this.y -= 0.35;
- wait(0.01);
- }
- this.deleteClone();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement