Objects - Moving Shapes in JAVA HELP PLEASE!
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.
* Draw your vehicle.
public void draw()
wL = new Circle ();
wR = new Circle ();
body1 = new Rectangle ();
body2 = new Rectangle ();
* Move your vehicle a little to the right.
public void moveRight()
* 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
Re: Objects - Moving Shapes in JAVA HELP PLEASE!
Please use code tags and not colour highlights when posting code.
Iterater over all the shapes and adjust their x co-ord.