Advertisement
Guest User

Untitled

a guest
Oct 19th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. stage {
  2.     scene Space("gallery:Scifi/Space")
  3.     let gameOn = 0;
  4.  
  5.     when stage.signalReceived("gameStart") {
  6.         gameOn = true;
  7.     }
  8.    
  9.     actor Star {
  10.         costume Idle("gallery:Galaxy/Star Idle")
  11.  
  12.         when stage.started {
  13.             this.hide();
  14.             this.size = 40;
  15.             this.setPosition(-350, Math.randomBetween(-180, 180));
  16.             stage.broadcast("gameStart");
  17.         }
  18.  
  19.         when stage.signalReceived("gameStart") {
  20.             this.wait(0.5);
  21.             while(gameOn) {
  22.                 if(gameOn){
  23.                     stage.createClone(this);
  24.                     this.wait(0.5);
  25.                 }
  26.             }
  27.         }
  28.  
  29.  
  30.  
  31.         when cloned {
  32.             this.y = Math.randomBetween(-180, 180);
  33.             this.show();
  34.             while(this.x <= 635) {
  35.                 this.x += 3;
  36.                 this.wait(0.02);
  37.                 if(this.touching(Spaceship)) {
  38.                     gameOn = false;
  39.                     Spaceship.hide();
  40.                     stage.broadcast("gameOver");  
  41.                 }
  42.             }
  43.             this.deleteClone();
  44.         }
  45.  
  46.         when stage.signalReceived("gameOver") {
  47.             this.deleteClone();
  48.         }        
  49.  
  50.     }
  51.  
  52.     actor Spaceship {
  53.         costume Fly("gallery:Galaxy/Spaceship Fly")
  54.  
  55.         when stage.started {
  56.             this.size = 30;
  57.             this.heading = 0;
  58.             this.hide();
  59.         }
  60.  
  61.         when stage.keyPressed("up arrow") {
  62.             this.y += 5;
  63.         }
  64.  
  65.         when stage.keyPressed("down arrow") {
  66.             this.y -= 5;
  67.         }
  68.  
  69.         when stage.signalReceived("gameStart") {
  70.             this.setPosition(280, 0);
  71.             this.show();
  72.         }
  73.  
  74.     }
  75.  
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement