camera smoothing only on y

This commit is contained in:
Jonas Braus
2024-08-05 00:19:18 +02:00
parent 6ef02c5628
commit a2f9549d15
17 changed files with 159 additions and 52 deletions
+7 -2
View File
@@ -72,11 +72,16 @@ func _ready():
pipedetector_ground.position.y = 0
collision_shape_2d.shape.height = 15
var camera_target_pos_y = 0
func _process(delta):
camera_2d.position.x = position.x + 50
if is_on_floor() or velocity.y > 0 and camera_2d.position.y < position.y:
camera_2d.position.y = position.y if not is_big else position.y + 8
if is_on_floor() or velocity.y > 0 and camera_target_pos_y < position.y:
camera_target_pos_y = position.y if not is_big else position.y + 8
if camera_target_pos_y != camera_2d.position.y:
camera_2d.position.y += (camera_target_pos_y - camera_2d.position.y) * 10 * delta
# set camera
if position.y <= 32: