xxxxxxxxxx
75
var w1=45
var w2=25
var h=25
var x=225
var y=270
var growButton
var waterP=4
var watercount=10
var timer=0
var bx=x+5
var by=y+60
var r=40
var Text='water'
function GrowButton(){
d=dist(mouseX,mouseY,bx,by)
if (d<r/2&&mouseIsPressed){
fill(0,100,200)
r=45
watercount-=1
} else{
fill(255)
r=40
}
circle(bx,by,r)
fill(0)
textSize(15)
text(Text,bx-18,by+5)
}
function increase(){
if (beanState<6&&watercount>0){
waterP+=4
watercount-=1
} else {
location.reload()
}
if (watercount<0){
watercount=0
}
}
function waterMeter(){
//the base
fill(255)
rect(x-w1/1.5,y,w1,h)
rect(x+w1/3,y,w2,h)
//the bar
if(waterP>40){
waterP=4
beanState+=1
}
fill(0,200,255)
rect(x-w1/1.6,y+5,waterP,h-10)
image(drop,243,272,20,20)
}
function waterCount(){
if (timer>=2600){
watercount+=1
timer=0
}
fill(255)
rect(25,25,65,40)
fill(0)
textSize(20)
text(watercount,35,52)
image(drop,60,35,20,20)
}