05-05-py-color-change-pt-2.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /**
  2. The ninja can change objects colors by using the isTouching and toggleDraggable
  3. functions. This is similar to the first Color Change activity but with additional
  4. functionality. The player should not be able to drag the circles once they have made
  5. the rectangle change color.
  6. hex codes not needed for this game, $this.fill() returns the current color
  7. yellow - #FEFD06
  8. green - #43C318
  9. red - #DE2121
  10. blue - #186EC3
  11. purple - #9608AF
  12. */
  13. //***********************button1 Object: Mouse Button Up Event********************//
  14. if($this.isTouching(rectangle)) {
  15. rectangle.fill($this.fill());
  16. $this.x(166);
  17. $this.y(440);
  18. $this.toggleDraggable();
  19. }
  20. //***********************button2 Object: Mouse Button Up Event********************//
  21. if($this.isTouching(rectangle)) {
  22. rectangle.fill($this.fill());
  23. $this.x(292);
  24. $this.y(440);
  25. $this.toggleDraggable();
  26. }
  27. //***********************button3 Object: Mouse Button Up Event*******************//
  28. if($this.isTouching(rectangle)) {
  29. rectangle.fill($this.fill());
  30. $this.x(420);
  31. $this.y(440);
  32. $this.toggleDraggable();
  33. }
  34. //***********************button4 Object: Mouse Button Up Event*******************//
  35. if($this.isTouching(rectangle)) {
  36. rectangle.fill($this.fill());
  37. $this.x(550);
  38. $this.y(440);
  39. $this.toggleDraggable();
  40. }
  41. //***********************button5 Object: Mouse Button Up Event*******************//
  42. if($this.isTouching(rectangle)) {
  43. rectangle.fill($this.fill());
  44. $this.x(684);
  45. $this.y(440);
  46. $this.toggleDraggable();
  47. }