01-04 589 B

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