what's wrong...
in
Programming Questions
•
2 years ago
I have this code that i'm writing where I'm trying to use an image in an array. I'm new to processing so this might be a dumb mistake. When I run this program it just comes up as a blank white screen. The image variable is "dude". Any help would be appreciated.
Here's what I got:
Dude[] dudes=new Dude [300];
PImage dude;
void setup() {
background(255);
size(700,700);
smooth();
for (int i= 0; i< dudes.length; i++) {
dudes[i] = new Dude (0, i*2,i/20.0);
}
}
void draw() {
for (int i=0; i< dudes.length; i++) {
dudes[i]. move();
dudes[i]. display();
}
}
class Dude{
float xpos;
float ypos;
float xspeed;
Dude(float xpos_, float ypos_, float xspeed_) {
xpos = xpos_;
ypos= ypos_;
xspeed= xspeed_;
}
void display() {
dude= loadImage("mens_room_full_page_blue.jpg");
}
void move(){
xpos=xpos + xspeed;
if (xpos>width) {
xpos= 0;
}
}
}
1