diff options
author | Logan <logan@cflip.net> | 2022-09-29 12:37:32 -0600 |
---|---|---|
committer | Logan <logan@cflip.net> | 2022-09-29 12:37:32 -0600 |
commit | 181f0aa422df02c14c9a4be9b59835661b3c5c07 (patch) | |
tree | 6981be84fb7d64c0f6d341433d4718b3ae63d4bf | |
parent | f6cd93bc976f58bd6f866e466364c5d608615d77 (diff) |
Added improvements to camera logic and zooming.
We'll probably want to refactor this at some point as it feels like it's
a pretty rough implementation, but it works and works well enough.
-rw-r--r-- | scenes/level.tscn | 2 | ||||
-rw-r--r-- | scripts/camera.gd | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/scenes/level.tscn b/scenes/level.tscn index f47ef03..1f89e81 100644 --- a/scenes/level.tscn +++ b/scenes/level.tscn @@ -25,6 +25,8 @@ limit_left = -202 limit_top = -150 limit_right = 214 limit_bottom = 120 +smoothing_enabled = true +smoothing_speed = 7.0 script = ExtResource( 6 ) [node name="Interface" parent="." instance=ExtResource( 4 )] diff --git a/scripts/camera.gd b/scripts/camera.gd index 264bc68..fb76159 100644 --- a/scripts/camera.gd +++ b/scripts/camera.gd @@ -2,3 +2,9 @@ extends Camera2D func _process(_delta): position = ($"../Basketball".position + $"../Hoop".position) / 2 + #if $"../Basketball".position.distance_to($"../Hoop".position) > limit_bottom: + #set_zoom(Vector2(1, 1) * ($"../Basketball".position.distance_to($"../Hoop".position) / limit_bottom)) + if ($"../Basketball".position.distance_to($"../Hoop".position) + $"../Basketball".drag_radius ) > limit_right: + set_zoom(Vector2(1, 1) * (($"../Basketball".position.distance_to($"../Hoop".position) + $"../Basketball".drag_radius) / limit_right)) + else: + set_zoom(Vector2(1, 1)) |