for some reason, when I install the game in different samsung mobiles, the movement behaves completely different, especially the jump function for some reason.
here's the movement code I have:
var left = false
var right = false
var double_jump = false
var vel = Vector2().ZERO
var speed = 500
func_process(delta):
if is_on_floor():
if Input.is_action_just_pressed("up"):
vel.y = -21
double_jump = true
elif Input.is_action_just_pressed("up") and double_jump:
vel.y = -21
double_jump = false
else:
vel.y -1
if left:
vel.x = -5
elif right:
vel.x = 5
else:
vel.x = 0
move_and_slide(vel*delta*speed, Vector2(0, -1))
and the touchscreen buttons are under a canvaslayer, that's instances as a child of the player's kinematic body(the kinematic body is also the root of the player's scene), here's the script for those:
onready var p = get_parent()
func _on_LeftKey_pressed():
p.left = true
func _on_RightKey_pressed():
p.right = true
func _on_LeftKey_released():
p.left = false
func _on_RightKey_released():
p.right = false
func _on_UpKey_pressed():
Input.action_press("up")
func _on_UpKey_released():
Input.action_release("up")