Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int i;
- boolean rectOverFeed = false;
- boolean changetofeeding = false;
- boolean changetobath = false;
- boolean rectOverBath = false;
- Feeding feed = new Feeding();
- int hunger = 185;
- int exp = 105;
- int level = 1;
- int exp_need = 10;
- Bath bath = new Bath();
- int option;
- void setup(){
- size(700,900);
- background(122);
- thread( "do_stuff" );
- }
- void draw(){
- background(122);
- if(changetobath == true){
- bath.draw();
- }else if(changetofeeding == true){
- feed.draw();
- hungerBar();
- }
- else {
- feedButton();
- bathButton();
- fill(0);
- pet();
- hungerBar();
- hexagonButton();
- text1();
- }
- }
- void hungerBar(){
- strokeWeight(5);
- rect(25,180,10,490);
- rect(675,180,-10,490);
- rect(100,40,500,10);
- stroke(150,75,0);
- strokeWeight(3);
- line(670,hunger+i,670,665);
- strokeWeight(1);
- stroke(0);
- }
- void text1(){
- fill(0);
- String name = "Johnny Sins";
- textAlign(CENTER,TOP);
- text(name,(width/2) - name.length() ,10);
- text(exp_need + " more exp to level up" ,(width/2) - name.length() ,50);
- text(level, 620 , 35);
- textSize(20);
- text("Hunger",620,180);
- text("HP",30,155);
- textSize(24);
- line(670,hunger+i,670,665);
- line(105,45,exp,45); //595 max
- text("FEED IT", 140,810);
- text("CLEAN",560,810);
- text("FIGHT",350,750);
- }
- void exp_mode(){
- int multiplier = 1;
- if (exp_need == 0){
- level+=1;
- exp_need = 10 * multiplier;
- multiplier += 1;
- }
- }
- void do_stuff() {
- while ( i < 480 ) {
- for (int k =0; k/5<100000; k++) {
- print( i, k );
- }
- i++;
- }
- }
- void pet(){
- fill(0);
- ellipse(280,470,100,300);
- ellipse(420,470,100,300);
- fill(255);
- ellipse(280,470,60,260);
- ellipse(420,470,60,260);
- fill(0);
- ellipse(350,500,300,300);
- fill(255,98,135);
- ellipse(350,560,150,100);
- fill(0);
- ellipse(360,510,140,80);
- fill(255,5,9);
- ellipse(350,585,102,52);
- fill(255);
- ellipse(300,450,80,80);
- ellipse(400,450,80,80);
- fill(98,107,250);
- ellipse(310,450,40,60);
- ellipse(410,450,40,60);
- fill(255);
- ellipse(315,450,20,40);
- ellipse(415,450,20,40);
- }
- void hexagonButton(){
- stroke(0);
- strokeWeight(5);
- fill(255,201,14);
- beginShape();
- translate(350,845);
- vertex(0, -150);
- vertex(80,-100);
- vertex(80, 0);
- vertex(0, 50);
- vertex(-80, 0);
- vertex(-80, -100);
- endShape(CLOSE);
- translate(-350,-845);
- strokeWeight(0);
- }
- 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);
- }
- void mousePressed() {
- if (rectOverFeed && option == 0) {
- changetofeeding = true;
- changetobath = false;
- option = 1;
- } else if (rectOverFeed && option == 1) {
- changetofeeding = false;
- changetobath = false;
- option = 0;
- } else if (rectOverBath){
- changetofeeding = false;
- changetobath = true;
- }
- }
- 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;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement