Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
kashimama
kashimama's Profile
1
Posts
6
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
Help
[10 Replies]
30-Mar-2012 11:57 AM
Forum:
Programming Questions
I cannot figure out for the life of me why I can't get this rray to work the way it should. Any suggestions would be great. Thanks.
float[] x = new float [600];
float[] y = new float [600];
float [] speed = new float[100];
void setup(){
size (400,300);
}
void draw(){
frameRate(5);
int i = 0;
while ( i < 100){
x[i] = (int)random (0,width);
y[i] = (int) random (0,height);
speed[i] = (int) random (1, 5);
i++;
}
int buglimit = 100;
int bug = (int) random(0, 100);
while (buglimit > bug){
color redd = (color) random (25,255);
color greenn = (color) random (25,255);
color blu = (color) random ( 25, 255 );
stroke(255);
fill(redd, greenn, blu);
//draw right wing
triangle(x[bug],y[bug], x[bug]-5,y[bug]-5,x[bug]-5,y[bug]+5);
//draw left wing
triangle ( x[bug],y[bug], x[bug]+5, y[bug]-5, x[bug]+5,y[bug]+5);
//draw butterfly body
fill(0);
ellipse(x[bug],y[bug],2,8);
y[bug] = y[bug] - speed[bug];
x[bug] =(int) random(0, width);
}
}
«Prev
Next »
Moderate user : kashimama
Forum