Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. class Feeding {
  2. boolean rectOverFeed = false;
  3. boolean rectOverBath = false;
  4.  
  5. void feedButton(){
  6. if (overRectFeed(40, 740, 200, 110)) {
  7. rectOverFeed = true;
  8. } else rectOverFeed = false;
  9. if (rectOverFeed){
  10. fill(255,231,30);
  11. } else fill(255,201,14);
  12. strokeWeight(5);
  13. rect(40, 740, 200, 110, 13);
  14. strokeWeight(0);
  15.  
  16. }
  17.  
  18. void bathButton(){
  19. if ( overRectBath(460, 740, 200, 110) ) {
  20. rectOverBath = true;
  21. } else rectOverBath = false;
  22. if (rectOverBath){
  23. fill(255,231,30);
  24. } else fill(255,201,14);
  25. strokeWeight(5);
  26. rect(460, 740, 200, 110, 13);
  27. strokeWeight(0);
  28. }
  29.  
  30.  
  31.  
  32. boolean overRectBath(int x, int y, int width, int height) {
  33. if (mouseX >= x && mouseX <= x+width &&
  34. mouseY >= y && mouseY <= y+height) {
  35. return true;
  36. } else {
  37. return false;
  38. }
  39. }
  40. boolean overRectFeed(int x, int y, int width, int height) {
  41. if (mouseX >= x && mouseX <= x+width &&
  42. mouseY >= y && mouseY <= y+height) {
  43. return true;
  44. } else {
  45. return false;
  46. }
  47. }
  48. void draw(){
  49. background(122);
  50. feedButton();
  51. bathButton();
  52.  
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement