Hello, I am in the middle of making jump king like game. I want to create the same camera movement like in the Jump King, but I have a little problem here. In this scenario the first level is 0 pixels, but when the player reaches it, the camera moves strange, idk how to explain, but the camera moves weirdly upper, but when the player fall down the camera doesnt go down. Here is my code so far, my resolution of the game is 800x600 if it help. Thanks for any help. <3
@export var camera_height: int = 600
@export var camera_limit_lower: int = 600
@export var camera_limit_upper: int = 0
func move_camera_to_match_player():
if position.y < camera_limit_upper:
camera_limit_lower -= camera_height
camera_limit_upper -= camera_height
change_camera_pos.emit(camera_limit_upper)
if position.y > camera_limit_lower:
camera_limit_lower += camera_height
camera_limit_upper += camera_height
change_camera_pos.emit(camera_limit_upper)