Hey guys,
I need some help... Basically I got a few shapes in java and made it into a car, I now need to move all the shapes together across the screen. How would I do this?
Here is my code, I can move one shape at a time but not all of them together.
public class Vehicle
{
private Circle wL;
private Circle wR;
private Rectangle b1;
private Rectangle b2;
/**
* Constructor for objects of class Vehicle.
*/
public Vehicle()
{
}
/**
* Draw your vehicle.
*/
public void draw()
{
wL = new Circle ();
wL.makeVisible();
wL.changeSize(60);
wL.moveVertical(130);
wL.moveHorizontal(100);
wR = new Circle ();
wR.makeVisible();
wR.changeSize(60);
wR.moveVertical(130);
wR.moveHorizontal(220);
body1 = new Rectangle ();
b1.makeVisible();
b1.changeSize(190, 60);
b1.moveVertical(80);
b1.moveHorizontal(70);
body2 = new Rectangle ();
b2.makeVisible();
b2.changeSize(100, 30);
b2.moveVertical(50);
b2.moveHorizontal(95);
}
/**
* Move your vehicle a little to the right.
*/
public void moveRight()
{
wheelR.slowMoveHorizontal(80);
wheelL.slowMoveHorizontal(80);
}
/**
* Move your vehicle a little to the left.
*/
public void moveLeft()
{
}
}
the section I put in red doesn't seem to work there but if i move it up to under the b2 part it works
using .slowMoveHorizontal(); under the yellow part I can get the shapes moving but one after the other. How do I correct this?
Thanks for reading