camera smoothing only on y
This commit is contained in:
+7
-2
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user