Coding the LevelManager class
We are nearly there. Coding this class will leave us with an executable project!
Create a new class called LevelManager
and add the following members and the constructor.
import android.content.Context; import android.graphics.PointF; import android.util.Log; import com.gamecodeschool.platformer.GOSpec.*; import com.gamecodeschool.platformer.Levels.*; import java.util.ArrayList; final class LevelManager { static int PLAYER_INDEX = 0; private ArrayList<GameObject> objects; private Level currentLevel; private GameObjectFactory factory; LevelManager(Context context, GameEngine ge, int pixelsPerMetre){ objects = new ArrayList<>(); factory = new GameObjectFactory(context, ge, pixelsPerMetre); }
First, be aware of the two highlighted import
statements that will need checking/correcting to your full package name.
We can tell we are getting...