How to make millis() count down from a number?
in
Programming Questions
•
11 months ago
Hi, I am quite new so please go easy.
I have working code that counts down, but it is from 0. I want to try and get millus() to start at 20 instead of 0 as my game has a time limit. Is there a way to do this?
Thanks
- //Timer Variables
- int m;
- int starttime;
- int seconds;
- void setup() {
- size(600, 600);
- }
- void draw() {
- background(255);
- //Milliseconds time counter converted to Seconds
- m = millis();
- seconds = -m / 1000;
- // when game started make timer 20
- starttime = 20 + seconds;
- //Display Timer
- fill(0);
- textSize(50);
- text(seconds, 80, 80);
- }
1