04-01-bumper-car.js 509 B

1234567891011
  1. /**
  2. A new function, flipDirection(), is introduced to simplify code that students used in their early activities,
  3. during their first lesson in moveX.
  4. **/
  5. //**********************Car Object: Update Every Frame Event********************//
  6. if ($this.x() >= 700 || $this.x() <= 100) { //go over what || means, and make sure
  7. //that ninja can explain the conditions of the if() statement
  8. $this.flipDirection(); //have ninjas explain what the following code is doing.
  9. $this.scaleX(-$this.scaleX());
  10. }