| 12345678910111213141516171819202122232425262728293031 |
- /**
- This activity is a simple extension of the previous lesson in flipDirection, adding the moveForward() function.
- */
- //**************circle_1 Object - Update Every Frame*****************//
- $this.moveForward(1); // move forward at a speed of 1
- if ($this.isTouching(balloon)) {
- // if the circle touches the balloon
- balloon.remove(); // remove the balloon.
- }
- if ($this.x() < 30) {
- // if the circle is too far left
- $this.flipDirection(); // flip its direction.
- }
- //***************circle_1 Object 0 Mouse Button Up Event************//
- $this.flipDirection();
- //*****************circle_2 Object - Update Every Frame**************//
- $this.moveForward(1);
- if($this.isTouching(balloon)){
- balloon.remove();
- }
- if($this.x() > 770){ //review x , y so ninja knows the coordinates referenced
- $this.flipDirection();
- }
- //***************circle_2 Object 0 Mouse Button Up Event************//
- $this.flipDirection();
|