01-04-rain-catcher-pt-4.js 593 B

123456789101112131415161718192021222324
  1. /**
  2. Raindrop is from the last activity, we have
  3. moved it to the scene**/
  4. //Scene - Initialize When Scene Starts
  5. if($this.scene.state() == "PLAY"){
  6. createTimer(1000, function(){
  7. var ndrop = drop.clone();
  8. var rainx = random(760,40);
  9. ndrop.x(rainx);
  10. ndrop.y(10);
  11. });
  12. //Lightning bolt cloning is very much the same
  13. //as cloning the rain drop
  14. createTimer(5000, function(){
  15. //insert clone code here
  16. var nbolt = bolt.clone();
  17. var boltX = random(760,40);
  18. nbolt.x(boltX);
  19. nbolt.y(10);
  20. });
  21. }