02-02 905 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //meteor - Update Every Frame
  2. moveX($this);
  3. moveY($this);
  4. var bullet = $this.scene.projectile;
  5. if(bullet && $this.isTouching(bullet)){
  6. $this.scaleX($this.scaleX()/2);
  7. $this.scaleY($this.scaleY()/2);
  8. $this.offsetX($this.offsetX()/2);
  9. $this.offsetY($this.offsetY()/2);
  10. $this.scene.projectile = null;
  11. bullet.remove();
  12. $this.scene.scoreValue++;
  13. score.text("Score: "+$this.scene.scoreValue);
  14. //this is where you add the code in step 3, inside the if ($this.isTouching(bullet)) statement
  15. //Good place to have ninja explain what this code is doing
  16. if (this.scaleX() >= 0.25) {
  17. var ncircle = $this.clone();
  18. ncircle.x($this.x()+100);
  19. } else {
  20. $this.remove();
  21. }
  22. }
  23. if($this.y()>700){
  24. $this.y(0);
  25. }
  26. if($this.y()<-100){
  27. $this.y(600);
  28. }
  29. if($this.x()>900){
  30. $this.x(0);
  31. }
  32. if($this.x()<-100){
  33. $this.x(800);
  34. }