The game runs on mobile without any problem on mid-end devices, and it should work fine on most devices too. However, our game isn't really suited to play on mobiles because of the input. We can fix that by adding analog sticks to the screens, as usual for a lot of games.
We'll create a new widget to handle this controller.
Let's fire up GameUI.java
:
public class GameUI { ... private ControllerWidget controllerWidget; public void setWidgets() { ... if (Gdx.app.getType() == Application.ApplicationType.Android) controllerWidget = new ControllerWidget(); } public void configureWidgets() { ... if (Gdx.app.getType() == Application.ApplicationType.Android) controllerWidget.addToStage(stage); } }
Addition to this class is a widget called ControllerWidget
. It adds the sticks...