Godot Version
3.4
Question
is there any possible way to lock a character to only move left and right
3.4
is there any possible way to lock a character to only move left and right
const LOCKED_Y : float = 50.0
func _process(delta: float) -> void:
position.y=LOCKED_Y
or perhaps you just do not want to read any up and down input? what are you wanting to do?
You could use Clamp() as it’s a useful function for this kind of thing. Also coding so the Y position isn’t impacted is also helpful but u must have a reason.
clamp(property, min, max)
position.y = clamp(position.y, 1, 1)
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.