Updating the levelManager, GameObjectFactory and GameObject
Now we can add the player (Bob), animated fire tiles and a scrolling background to the game.
In the long switch
block of the LevelManager
class uncomment the following highlighted code to build backgrounds, player and the animated fire tiles.
switch (levelToLoad.get(row) .charAt(column)){ case '1': //objects.add(factory.create( // new BackgroundCitySpec(), // coords)); break; case '2': //objects.add(factory.create( // new BackgroundUndergroundSpec(), // coords)); break; case '3': //objects.add(factory.create( // new BackgroundMountainSpec(), // coords)); break; case 'p': //objects.add(factory.create(new // PlayerSpec(), // coords)); // Remember the location of // the player //PLAYER_INDEX ...
Get Learning Java by Building Android Games - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.