How to use touch triggers Simultaneously for Character Movements

#1

Currently I am working on movement of a character using touch triggers game input. and bind it on gui text, whenever the player click the text “move right” or “jump” text, the character will act accordingly on press actions however I want to perform those action simultaneously for example while moving right, I want to make the character jump but it does not work. only single action at a time.

Here are my code

function on_input(self, action_id, action)
		local id = nil
		if action_id == hash("on_touch") then
			if gui.pick_node(gui.get_node("title"), action.x, action.y) then
				id = hash("move_right")
				print("move")
			elseif gui.pick_node(gui.get_node("jump"), action.x, action.y) then
				id = hash("player_jump")
				print("jump")
			end
		elseif action_id == hash("secondary_touch") then
			
		end
		
		if id then
			msg.post("/player", id, {})
		end
end
0 Likes

#2

You need to use multi touch. I have an example here:

And you can read the manual here:

1 Like