Hello all,
I'm trying to get my objects follow an other object. Here is my code till now:
In this code I let the objects follow 'Boot'. The 'Boot' keeps track of how much weight there is in 'Boot' and who is intersecting him. I want 'Boot' to sink a every time an objects intersects him.
Help please.
public int weight; // instance variable private int limit = 300; //instance variable public boolean isOverWeight() { List<Persoon> personen = (List<Persoon>)getIntersectingObjects(Persoon.class); int currentWeight = 0; for (Persoon persoon : personen) { currentWeight += persoon.getWeight() ; } if (currentWeight >= 49) { setLocation (getX(), getY() +1); //setLocation (List<Persoon>)getIntersectingObjects(Persoon.class) (getX() getY() +5); } return currentWeight > 300; }