Hello there! I'm creating a "Crossy Road"-ish game and some of the vehicles tend to overlap one another (an actor goes underneath another actor). In order to solve this, I put this method called "setPaintOrder" to hopefully align my actor classes correctly. However, it was working for all of the cars til I got to the police car (and all the cars after I implemented the police car, as well). I have the police car set at a specific speed (5), but for some reason it got faster once I inserted it into the method parameter list of setPaintOrder. FYI, I have the speed set at 5 for another car that's ALSO in setPaintOrder, but it's slower than the police car. Why is this happening and is there a way to fix this? Thank you, and my code for the police car along with the code for my setPaintOrder will be posted below!
Code for the police car:
Code for my setPaintOrder:
public void act() { setLocation(getX() - 5, getY()); wrapAtEdge(); };
setPaintOrder(Police.class, Car2.class, Car4.class, Car1.class, Car3.class, Car5.class, Train.class, Trailer.class, Van.class, Motorcycle.class, Firetruck.class, Police.class, Log.class, Lilypad.class, Chicken.class, Water.class);