Add an ArrayList to another ArrayList

You don’t need a class for collisions you test for these in the Player class

public class Player {

  public Obstacle collision(ArrayList<Obstacle> list){
    // return the obstacle it collides with or null if no collision
  }

]

So the world update method algorithm would be

  • move the player
  • test for collision
  • if collision and obstacle edible remove it from list
1 Like