01-05-rain-catcher-pt-5.js 743 B

123456789101112131415161718192021222324252627
  1. //turtleSprite - Initialize When Scene Starts
  2. //raindrop cloning
  3. if($this.scene.state() == "PLAY"){
  4. createTimer(1000, function(){
  5. var ndrop = drop.clone();
  6. var rainX = random(760,40);
  7. ndrop.x(rainX);
  8. ndrop.y(10);
  9. });
  10. //lightning bolt cloning
  11. createTimer(5000, function(){
  12. var nbolt = bolt.clone();
  13. var boltx = random(760,40);
  14. nbolt.x(boltx);
  15. nbolt.y(10);
  16. });
  17. //This code will be new - but still the same as the last 2 activities
  18. //snowflake cloning
  19. //Add createTimer function for snowflake here
  20. createTimer(5000, function() {
  21. var nflake = snowflake.clone();
  22. var flakeX = random(760,40);
  23. nflake.x(flakeX);
  24. nflake.y(10);
  25. });
  26. }