Game Development Reference
In-Depth Information
Figure 10-7 . Add a COLLIDE_CHECKLIST List<Actor> object, .getCollideCheckList(), and resetCollideCheck-
List() methods
A .getCollideCheckList() method uses a return keyword, to give access to the
COLLIDE_CHECKLIST, like this:
public List getCollideCheckList () {
return COLLIDE_CHECKLIST ;
}
A .resetCollideCheckList() method uses a .clear() method to clear out the
COLLIDE_CHECKLIST and then uses an .addAll() method to add (insert) the con-
tents of the CURRENT_CAST object into the COLLIDE_CHECKLIST object.
public void resetCollideCheckList () {
COLLIDE_CHECKLIST .clear();
COLLIDE_CHECKLIST .addAll(CURRENT_CAST);
}
Now that we have our ArrayList<Actor> objects set up to hold cast members and
advanced collision list data sets, let's create a HashSet<Actor> object. This Set object
will be used to collect Actors that for one reason or another need to be removed from
the game play (the Scene and the Stage).
 
Search WWH ::




Custom Search