Well, the problem is in order to finish my project about garbage collector trucks. The assignment is: If a route didn't finish and there are available trucks, there must go out another truck and start the picking where the other one finished.
The user chooses how many trucks they are gonna be in the simulation and I assign them the route randomly
What I want to do: If there are 10 trucks, and of those 10, four have the same route, just the first of those four starts moving. If this one does not finish the route, then the second one starts moving.
How?
In order to do so I've thought of getIntersectingObjetcs method, which I think returns a List of all the objects that are intersecting mine. Since at the beginning of the simulation they all intersect each other, it will return all the objects and then i will read the route assigned randomly and if it's the same one i'll pause its movement till the other goes away.
The problem?
I don't know how to implement that. I've tried creating a List in my Truck class: But then How do I read from that list the route of the truck?
Is this way of pausing movement when there's one equal actor (same route makes it an equal object) too hard to implement?
Is there a better way to do so?
How do I read the information from the list of actors?
Thanks again!
You're helping me a lot!
List=getIntersectingObjects(Truck.class);
