Coding a stripped down GameObjectFactory
The next step is to code the GameObjectFactory
class. This class will look very similar to the class of the same name in the previous project but there will be a few differences that I will point out. We will code just enough in order to build the game objects that are ready to be built and we will revisit this class in the next chapter once we have finished coding all the component classes.
Tip
In this and other upcoming classes remember to check that when you import your own classes (everything from the GOSpec
package) make sure/change to the correct package name.
Add a new class called GameObjectFactory
and add the following member variables and constructor method.
import android.content.Context;
import android.graphics.PointF;
import com.gamecodeschool.platformer.GOSpec.GameObjectSpec;
class GameObjectFactory {
private Context mContext;
private GameEngine mGameEngineReference;
private int mPixelsPerMetre;
GameObjectFactory(Context...