Okay so this is my fourth time posting the same thing because no one is posting
ID: 3775028 • Letter: O
Question
Okay so this is my fourth time posting the same thing because no one is posting the right answering or is even doing the one thing im asking them to... I'm sorry for the attitude but my project is due soon so please answer if you have the right answer. For this class I made I have a moving screen with trump's head in the middle. I was wondering if you could make a NEW CLASS and make it MOVE trumps head from this class by CLICKING the button w to MOVE UP and s TO MOVE DOWN. I just need two moving functions in the class...
public static void main(String[] args) {
// Setup EZ graphics system.
EZ.initialize(1000,500); // PIXEL picture element
EZImage sky1 = EZ.addImage("skyrepeat.jpg", 500,255);
EZImage sky2 = EZ.addImage("skyrepeat.jpg", 1500, 255);
EZImage[] trumpPictures = new EZImage[1];
for (int i=0; i < 1; i++){
trumpPictures[i]= EZ.addImage("bird.png", 500, i*100+250);//i starts at 0. use 50 to determine the first vertical position
} //variable is no longer in scope
while (true) {
for (int i = 0; i < 1; i++){
sky1.moveForward(-1);
sky2.moveForward(-1);
if (sky1.getXCenter() < -500) {
sky1.moveForward(2000);
}
if (sky2.getXCenter() < -500) {
sky2.moveForward(2000);
}
EZ.refreshScreen();
}
}
}}
Explanation / Answer
public static void main(String[] args) {
// Setup EZ graphics system.
EZ.initialize(1000,500); // PIXEL picture element
EZImage sky1 = EZ.addImage("skyrepeat.jpg", 500,255);
EZImage sky2 = EZ.addImage("skyrepeat.jpg", 1500, 255);
EZImage[] trumpPictures = new EZImage[1];
for (int i=0; i < 1; i++){
trumpPictures[i]= EZ.addImage("bird.png", 500, i*100+250);//i starts at 0. use 50 to determine the first vertical position
} //variable is no longer in scope
while (true) {
for (int i = 0; i < 1; i++){
sky1.moveForward(-1);
sky2.moveForward(-1);
if (sky1.getXCenter() < -500) {
sky1.moveForward(2000);
}
if (sky2.getXCenter() < -500) {
sky2.moveForward(2000);
}
EZ.refreshScreen();
}
}
}}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.