10 Input Map, Canvas layer, Android Export, TouchScreenButton 

So, Today we will talk about Input Map, Canvas Layer, Android Export (running on android debug) and TouchScreenButton

We will add On Screen Control, That Jump, Left and Right.

Input Map

We can add different actions to be Input Map, and get those action event using the Input Class.

...................
	# Handle jump.
	if Input.is_action_just_pressed("jump") and is_on_floor():
		velocity.y = JUMP_VELOCITY

	# Get the input direction and handle the movement/deceleration.
	# As good practice, you should replace UI actions with custom gameplay actions.
	
	if !is_hit:
		var direction = Input.get_axis("left", "right")
...................

These Actions are defined from Project > Project Settings > Input Map

Canvas Layer

Canvas Layer is the layer which stays with the screen and does not move along with the camera. This layer is used for HUD (Head Up Display) and To add the Touch Screen Button Actions.

Android Export

We can run the game in our android phone, first we have to install the android build template. We can do so from Project > Install Android Build Template

Once the Template is installed, you need to setup JAVA_HOME envs, Android SDKs. We will talk about it in detailed in later.

We can Add Android Export and run the phone in the Android. There are different Architecture of Android, make sure you checked the required one in the export.

TouchScreenButton

We can add TouchScreenButton to the game and they will trigger the defined action, thus just add the Touch Screen Button, Add the Normal and Pressed Texture, define the action to trigger. That's it.

In the Video and as show in the above picture, I show a manual way to hide the Buttons. But Looks Like the TouchScreenButton themselves have the option called Visibility Mode which we can set to Always / Touch Only.