Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am working on a project in processing, and I thought I was complete, but my pr

ID: 3759739 • Letter: I

Question

I am working on a project in processing, and I thought I was complete, but my professor gave me this feedback.

"One major mistake is that you used 1 variable for the position of ALL objects. Please use different variables, such as pos1, pos2, pos3, etc. That way the motion of the objects will be independent from the others.
You have one variable for position, when you need a separate one for each object/image (I would like variety in movement). So you'll need a separate variable for each image that is moving. A good way to organize it would be to name them "plane_pos" or "bee_pos", etc. And for the objects that you want to move up and down, you'll need to positions, one for the x plane and one for the y plane."

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 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,pos,0,500,500);
pos-=0.01;
image(twinbirds,pos,50,0);
pos+=2.5;
image(jetplane,pos,100,0);
pos-=1.1;
image(passingcloud,pos,150,0);
pos+=0.1;
image(bee,pos,200,0);
pos-=3;

}

Explanation / Answer

in your method

Void Draw() you used variable "pos" so many times. Your professor wants to change these variables.

// 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;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote