Implementing the camera and displaying a map in the render loop
The next class to review is MainGameScreen
, which can be found at core/src/com/packtpub/libgdx/bludbourne/screens/MainGameScreen.java
. The MainGameScreen
class is the first Screen
implementation for our game and represents the main gameplay screen used to display the game map, player avatar, and any UI components.
MainGameScreen
The class diagram for MainGameScreen
(Figure 8) shows all the attributes and method signatures for our first pass:
The import packages for MainGameScreen
are as follows:
package com.packtpub.libgdx.bludbourne.screens; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Screen; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.maps.MapLayer; import com.badlogic.gdx.maps.MapObject; import com.badlogic.gdx.maps.objects.RectangleMapObject...