<//Increase perSec
int perSec = 0;
//Time
int time = 0;
//Amount of current milk
int amount = 0;
//Milk image
PImage milky;
//Font setting
PFont BoldFont;
void setup() {
//Canvas Size
size(500,500);
//Fonts
BoldFont = createFont(“Arial Bold”, 18);
//Images
milky = loadImage(“milky.png”);
//Time
time = millis();
}
void draw() {
//Background
background(0);
//Milky the Milkbox
//rectMode(CENTER);
//rect(100,100,64,64);
imageMode(CENTER);
image(milky,100,100);
//Prints Current Amount of Milk on Canvas
textFont(BoldFont);
text(“We have " + amount + " boxes of milk” ,20,50);
//Store
text(" Store", 350,200);
stroke(200,0,0);
strokeWeight(5);
line(320,175,320,500);
line(320,175,500,175);
line(320,210,500,210);
//İnek
stroke(0);
rectMode(CENTER);
rect(350,240,50,50);
amount = amount + perSec;
}
void mousePressed()
{
// Coordinates print to locate stuff
print(mouseX,mouseY, " ");
// Increase amount of milk when clicked on milk box.
if(mouseX > 78 && mouseX < 123 && mouseY > 75 && mouseY < 128){
amount = amount+1;
}
//Increase “perSec” when Cow is Bought.
if(mouseX > 325 && mouseX < 375 && mouseY > 215 && mouseY < 265){
amount = amount - 100;
perSec = perSec + 0.10;
}
}
On the bottom line, I won’t allow me to set a decimal as an increment, I am pretty new to this thing. Couldn’t think of any solution. I tried creating a new int such as , that would not work either.