I am working on a project in processing, and I thought I was complete, but my pr
ID: 3759786 • Letter: I
Question
I am working on a project in processing, and I thought I was complete, but my professor gave me this feedback.
"It looks like some positions for your objects are set to other object's positions. If you want an object to move independent of the others, make it set to itself, then add the speed. So jetPlane_pos would be set to jetPlane_pos + whatever speed you want"
This is what I have so far. Not sure what I have to do to fix what my professor said.
// PImage variables
PImage nwimg;
PImage twinbirds;
PImage jetplane;
PImage passingcloud;
PImage bee;
float bee_pos;
float nwing_pos;
float twinBirds_pos;
float jetPlane_pos;
float passingCloud_pos;
// load images
void setup()
{
size(1200,800);
nwimg = loadImage("walebeach.jpeg");
twinbirds= loadImage("twinbirds.png");
jetplane= loadImage("jetplane.png");
passingcloud= loadImage("passingcloud.png");
bee= loadImage("bee.jpeg");
}
// Display the image
void draw()
{
background(0);
image(nwimg,nwing_pos,0,500,500);
twinBirds_pos = nwing_pos-0.01;
image(twinbirds,twinBirds_pos,50,0);
jetPlane_pos = twinBirds_pos+2.5;
image(jetplane,jetPlane_pos,100,0);
passingCloud_pos = jetPlane_pos-1.1;
image(passingcloud,passingCloud_pos,150,0);
bee_pos = passingCloud_pos+0.1;
image(bee,bee_pos,200,0);
nwing_pos = bee_pos-3;
}
Explanation / Answer
PImage nwimg;
PImage twinbirds;
PImage jetplane;
PImage passingcloud;
PImage bee;
float bee_pos;
float nwing_pos;
float twinBirds_pos;
float jetPlane_pos;
float passingCloud_pos;
// load images
void setup()
{
size(1200,800);
nwimg = loadImage("walebeach.jpeg");
twinbirds= loadImage("twinbirds.png");
jetplane= loadImage("jetplane.png");
passingcloud= loadImage("passingcloud.png");
bee= loadImage("bee.jpeg");
}
// Display the image
void draw()
{
background(0);
image(nwimg,nwing_pos,0,500,500);
twinBirds_pos = twinBirds_pos-0.01;
image(twinbirds,twinBirds_pos,50,0);
jetPlane_pos = jetPlane_pos+2.5;
image(jetplane,jetPlane_pos,100,0);
passingCloud_pos = passingCloud_pos-1.1;
image(passingcloud,passingCloud_pos,150,0);
bee_pos = bee_pos+0.1;
image(bee,bee_pos,200,0);
nwing_pos = nwing_pos-3;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.