Building the GameObjectFactory class
It is the job of the GameObjectFactory
class to use the ObjectSpec-based classes to assemble GameObject
instances with the correct components.
Create a new class called GameObjectFactory
and add the following members and constructor:
import android.content.Context; import android.graphics.PointF; class GameObjectFactory { Â Â Â Â private Context mContext; Â Â Â Â private PointF mScreenSize; Â Â Â Â private GameEngine mGameEngineReference; Â Â Â Â GameObjectFactory(Context c, PointF screenSize, Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â GameEngine gameEngine) { Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â this.mContext = c; Â Â Â Â Â Â Â Â this.mScreenSize = screenSize; Â Â Â Â Â Â ...