Update LevelManager and GameObjectFactory
Now we have a new object ready to go we can quickly update the LevelManager
and GameObjectFactory
. Uncomment this code in the LevelManager
class.
case 'm': //objects.add(factory.create( // new MoveablePlatformSpec(), // coords)); break;
Add this highlighted line of code to the GameObjectFactory
class.
... case "InanimateBlockUpdateComponent": object.setMovement(new InanimateBlockUpdateComponent()); break; case "MovableBlockUpdateComponent": // Code coming soon object.setMovement(new MovableBlockUpdateComponent()); break; case "DecorativeBlockUpdateComponent": object.setMovement(new DecorativeBlockUpdateComponent()); break; ...
The LevelManager
will now request moving platforms from the factory and the factory knows how to construct the moving platforms.