| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- //meteor - Update Every Frame
- moveX($this);
- moveY($this);
- var bullet = $this.scene.projectile;
- if(bullet && $this.isTouching(bullet)){
-
- $this.scaleX($this.scaleX()/2);
- $this.scaleY($this.scaleY()/2);
- $this.offsetX($this.offsetX()/2);
- $this.offsetY($this.offsetY()/2);
-
- $this.scene.projectile = null;
- bullet.remove();
-
- $this.scene.scoreValue++;
- score.text("Score: "+$this.scene.scoreValue);
- //this is where you add the code in step 3, inside the if ($this.isTouching(bullet)) statement
- //Good place to have ninja explain what this code is doing
- if (this.scaleX() >= 0.25) {
- var ncircle = $this.clone();
- ncircle.x($this.x()+100);
- } else {
- $this.remove();
- }
- }
- if($this.y()>700){
- $this.y(0);
- }
- if($this.y()<-100){
- $this.y(600);
- }
- if($this.x()>900){
- $this.x(0);
- }
- if($this.x()<-100){
- $this.x(800);
- }
|