Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
zizi50
zizi50's Profile
2
Posts
0
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
Changing Direction???
[1 Reply]
21-Mar-2012 05:36 AM
Forum:
Programming Questions
Anyone able to make the lines go back when the reach the right edge and go forward when they reach the left again? Please and Thanks
int endX = 0;
void setup() {
size(200, 200);
frameRate (10);
endX = (0);
}
void draw() {
background (255);
stroke(0);
for (int x = 0; x < endX; x+=10) {
line(x, 0, x, height);
}
endX +=10;
if (endX > height) {
endX = 0;
}
}
How to change colour on impact
[1 Reply]
06-Mar-2012 12:12 PM
Forum:
Programming Questions
Hey just having difficulties changing the colour of the triangle now every time it hits an edge, anyone able to help please?
int x = 100;
int y = 0;
int speed = 5;
int state = 0;
void setup() {
size(200, 200);
// frameRate(3);
}
void draw() {
background(255);
stroke(0);
fill(175);
// rect(x, y, 9, 9);
triangle (x, y,
x+9, y,
x+4.5, y+9 );
if (state == 0) {
x = x + speed;
y = y + speed;
if (x > width-10) {
x = width-10;
state = 1;
}
}
else if (state == 1) {
x = x - speed;
y = y + speed;
if (y > height-10) {
y = height-10;
state = 2;
}
}
else if (state == 2) {
x = x - speed;
y = y - speed;
if (x < 0) {
x = 0;
state = 3;
}
}
else if (state == 3) {
x = x + speed;
y = y - speed;
if (y < 0) {
y = 0;
state=0;
}
}
}
«Prev
Next »
Moderate user : zizi50
Forum