04-08-PY-candy-sort.js 914 B

123456789101112131415161718192021222324
  1. /**
  2. One of 3 random candies drops down the chute onto the conveyor belt and
  3. into one of the bins. The player uses the arrow keys to shift the bins so
  4. that the candy drops into the matching colored bin. There is already a Boolean
  5. key check (bins.keyDown) to detect if either of the arrows has been pressed.
  6. The code for moving the bins is already attached to the group. Ninjas should
  7. reference the timer code from Rain Catcher and Whack a Ninja.
  8. Decomposition
  9. * Candy move down the chute
  10. * Candy changes direction to moves along belt
  11. * Arrow keys control chutes
  12. * Timer is used to spawn new candies
  13. * Check if the correct color dropped in bins
  14. */
  15. //*************Scene Object - Initialize When Scene Starts***********//
  16. //Create score variable
  17. $this.totalScore = 0;
  18. //Create variable to match binColor with candyColor
  19. $this.binColor = 0;
  20. //boolean used to check which arrow is pressed
  21. bins.keyDown = false;