Hi, first time using Godot with very little programming knowledge.
I'm trying to set up limits for a Camera2D that can be moved with input keys. The inspector lets you set up limits, but those limits only affect the frame of the camera, not the actual Camera node that keeps moving beyond those limits, creating a delay when i turn back the other way (the camera frame doesn't move until the node moves back inside the limits, only then it moves again)
So i wrote very basic lines to force positions, but strangely it's only working on the X axis, not on Y. The Y position seems to be all wrong from the start for some reason.
Can someone help me figure out why this is happening?
Thanks!
`func _process(delta):
Input.get_vector("Left","Right","Up","Down")
if Input.is_action_pressed("Up"):
position+=Vector2(0,-500)*delta
if Input.is_action_pressed("Down"):
position+=Vector2(0,500)*delta
if Input.is_action_pressed("Left"):
position+=Vector2(-500,0)*delta
if Input.is_action_pressed("Right"):
position+=Vector2(500,0)*delta
if position < Vector2(187,0):
position.x = (187)
if position > Vector2(953,0):
position.x = (953)
if position < Vector2(0,107):
position.y = (107)
if position > Vector2(0,530):
position.y = (530)`