Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
nicholas68
nicholas68's Profile
3
Posts
3
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
How to make millis() count down from a number?
[3 Replies]
01-Nov-2012 06:41 PM
Forum:
Programming Questions
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);
}
Why wont this work?
[2 Replies]
01-Nov-2012 03:05 AM
Forum:
Programming Questions
So I am fairly new to processing. But I though I could have and inside an IF condition, so I am confused why this isn't working?
int colour = (int) random(3);
int rectcolour;
void setup() {
size(600, 600);
rectMode(CENTER);
smooth();
}
void draw() {
switch(colour) {
case 0:
fill(255, 0, 0);
break;
case 1:
fill(0, 255, 0);
break;
case 2:
fill(0, 0, 255);
break;
}
//rect(width/2, height/2, 200, 100);
fill(255, 0, 0);
rect(125, 525, 100, 50);
fill(0, 255, 0);
rect(300, 525, 100, 50);
fill(0, 0, 255);
rect(475, 525, 100, 50);
rectColour;
rect(width/2, height/2, 200, 100);
}
void mousePressed() {
if(mouseX > 0 && < 300) {
rectColour = fill(0, 255, 0);
}
if(mouseX > 300 && < 600) {
rectColour = fill(0, 0, 255);
}
}
Collision is only working on one box, anyone know why?
[3 Replies]
29-Oct-2012 08:24 PM
Forum:
Programming Questions
See third post.
«Prev
Next »
Moderate user : nicholas68
Forum