Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Feeding {
- boolean rectOverFeed = false;
- boolean rectOverBath = false;
- void feedButton(){
- if (overRectFeed(40, 740, 200, 110)) {
- rectOverFeed = true;
- } else rectOverFeed = false;
- if (rectOverFeed){
- fill(255,231,30);
- } else fill(255,201,14);
- strokeWeight(5);
- rect(40, 740, 200, 110, 13);
- strokeWeight(0);
- }
- void bathButton(){
- if ( overRectBath(460, 740, 200, 110) ) {
- rectOverBath = true;
- } else rectOverBath = false;
- if (rectOverBath){
- fill(255,231,30);
- } else fill(255,201,14);
- strokeWeight(5);
- rect(460, 740, 200, 110, 13);
- strokeWeight(0);
- }
- boolean overRectBath(int x, int y, int width, int height) {
- if (mouseX >= x && mouseX <= x+width &&
- mouseY >= y && mouseY <= y+height) {
- return true;
- } else {
- return false;
- }
- }
- boolean overRectFeed(int x, int y, int width, int height) {
- if (mouseX >= x && mouseX <= x+width &&
- mouseY >= y && mouseY <= y+height) {
- return true;
- } else {
- return false;
- }
- }
- void draw(){
- background(122);
- feedButton();
- bathButton();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement