Countdown to a game
in
Programming Questions
•
2 years ago
ive made a countdown for a game but i am having trouble finding where to place it.
i start the game with a start button and then i want the countdown to begin 3 2 1 (as i have created) then after the 3 2 1 the game should start. but thats the function im having trouble with.
thank you if anyone can point me in the right direction :)
(countdown code below)
int sec=0;
void setup(){
size(320,600);
smooth();
}
void draw(){
background(0);
sec=second();
for(int lop=0;lop<5;lop++){
if(sec>10)sec=second()-(10*lop);
}
////seconds////
if(sec==3){
rect(240,80,48,160);
rect(240,288,48,160);
}
if(sec==2){
rect(80,32,160,48);
rect(80,240,160,48);
rect(32,288,48,160);
rect(80,448,160,48);
rect(240,80,48,160);
}
if(sec==1){
rect(80,32,160,48);
rect(80,240,160,48);
rect(80,448,160,48);
rect(240,80,48,160);
rect(240,288,48,160);
}
}
1