better cam

This commit is contained in:
Jonas Braus
2024-08-04 20:13:26 +02:00
parent 7946fd789c
commit 2ea5608b12
7 changed files with 121 additions and 54 deletions
+21
View File
@@ -19464,5 +19464,26 @@ position = Vector2(1296, 0)
[node name="StaticBody2D3" parent="." instance=ExtResource("15_ac2kk")]
position = Vector2(1328, 0)
[node name="Camera2D" type="Camera2D" parent="."]
unique_name_in_owner = true
position = Vector2(35, 0)
zoom = Vector2(3, 3)
limit_left = -160
limit_top = -184
limit_bottom = 32
position_smoothing_enabled = true
position_smoothing_speed = 10.0
[node name="ColorRect" type="ColorRect" parent="Camera2D"]
unique_name_in_owner = true
visible = false
z_index = 50
offset_left = -3995.0
offset_top = -1678.0
offset_right = 3965.0
offset_bottom = 1594.0
mouse_filter = 1
color = Color(0, 0, 0, 1)
[connection signal="body_entered" from="WorldBoundDown" to="WorldBoundDown" method="_on_body_entered"]
[connection signal="timeout" from="WorldBoundDown/Timer" to="WorldBoundDown" method="_on_timer_timeout"]
+21
View File
@@ -45851,5 +45851,26 @@ position = Vector2(216, -679)
load_level = "level_0"
level_score = 3
[node name="Camera2D" type="Camera2D" parent="."]
unique_name_in_owner = true
position = Vector2(35, 0)
zoom = Vector2(3, 3)
limit_left = -160
limit_top = -184
limit_bottom = 32
position_smoothing_enabled = true
position_smoothing_speed = 10.0
[node name="ColorRect" type="ColorRect" parent="Camera2D"]
unique_name_in_owner = true
visible = false
z_index = 50
offset_left = -3995.0
offset_top = -1678.0
offset_right = 3965.0
offset_bottom = 1594.0
mouse_filter = 1
color = Color(0, 0, 0, 1)
[connection signal="body_entered" from="WorldBoundDown" to="WorldBoundDown" method="_on_body_entered"]
[connection signal="timeout" from="WorldBoundDown/Timer" to="WorldBoundDown" method="_on_timer_timeout"]
+21
View File
@@ -7881,5 +7881,26 @@ position = Vector2(1712, -96)
[node name="StaticBody2D11" parent="invisibleBarriers" instance=ExtResource("13_6mf4p")]
position = Vector2(1968, 0)
[node name="Camera2D" type="Camera2D" parent="."]
unique_name_in_owner = true
position = Vector2(35, 0)
zoom = Vector2(3, 3)
limit_left = -160
limit_top = -184
limit_bottom = 32
position_smoothing_enabled = true
position_smoothing_speed = 10.0
[node name="ColorRect" type="ColorRect" parent="Camera2D"]
unique_name_in_owner = true
visible = false
z_index = 50
offset_left = -3995.0
offset_top = -1678.0
offset_right = 3965.0
offset_bottom = 1594.0
mouse_filter = 1
color = Color(0, 0, 0, 1)
[connection signal="body_entered" from="WorldBoundDown" to="WorldBoundDown" method="_on_body_entered"]
[connection signal="timeout" from="WorldBoundDown/Timer" to="WorldBoundDown" method="_on_timer_timeout"]
+21
View File
@@ -7459,5 +7459,26 @@ hit_object = ExtResource("7_vhpxe")
position = Vector2(1664, -48)
hit_object = ExtResource("14_xdsdd")
[node name="Camera2D" type="Camera2D" parent="."]
unique_name_in_owner = true
position = Vector2(35, 0)
zoom = Vector2(3, 3)
limit_left = -160
limit_top = -184
limit_bottom = 32
position_smoothing_enabled = true
position_smoothing_speed = 10.0
[node name="ColorRect" type="ColorRect" parent="Camera2D"]
unique_name_in_owner = true
visible = false
z_index = 50
offset_left = -3995.0
offset_top = -1678.0
offset_right = 3965.0
offset_bottom = 1594.0
mouse_filter = 1
color = Color(0, 0, 0, 1)
[connection signal="body_entered" from="WorldBoundDown" to="WorldBoundDown" method="_on_body_entered"]
[connection signal="timeout" from="WorldBoundDown/Timer" to="WorldBoundDown" method="_on_timer_timeout"]
+21
View File
@@ -29404,5 +29404,26 @@ position = Vector2(3079, -17)
load_level = "level_0"
level_score = 6
[node name="Camera2D" type="Camera2D" parent="."]
unique_name_in_owner = true
position = Vector2(35, 0)
zoom = Vector2(3, 3)
limit_left = -160
limit_top = -184
limit_bottom = 32
position_smoothing_enabled = true
position_smoothing_speed = 10.0
[node name="ColorRect" type="ColorRect" parent="Camera2D"]
unique_name_in_owner = true
visible = false
z_index = 50
offset_left = -3995.0
offset_top = -1678.0
offset_right = 3965.0
offset_bottom = 1594.0
mouse_filter = 1
color = Color(0, 0, 0, 1)
[connection signal="body_entered" from="WorldBoundDown" to="WorldBoundDown" method="_on_body_entered"]
[connection signal="timeout" from="WorldBoundDown/Timer" to="WorldBoundDown" method="_on_timer_timeout"]
+9 -52
View File
@@ -190,7 +190,7 @@ length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Camera2D/ColorRect:visible")
tracks/0/path = NodePath("dieSound:playing")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
@@ -199,18 +199,6 @@ tracks/0/keys = {
"update": 1,
"values": [false]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("dieSound:playing")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
[sub_resource type="Animation" id="Animation_jgvs8"]
resource_name = "die"
@@ -218,34 +206,22 @@ length = 3.0
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Camera2D/ColorRect:visible")
tracks/0/path = NodePath("dieSound:playing")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("dieSound:playing")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0.1),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/2/type = "method"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath(".")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
tracks/1/type = "method"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(3),
"transitions": PackedFloat32Array(1),
"values": [{
@@ -266,25 +242,6 @@ collision_layer = 2
script = ExtResource("1_lm7ix")
fireball_prefab = ExtResource("2_owoxk")
[node name="Camera2D" type="Camera2D" parent="."]
position = Vector2(35, 0)
zoom = Vector2(3, 3)
limit_left = -160
limit_top = -184
limit_bottom = 32
limit_smoothed = true
position_smoothing_speed = 8.0
[node name="ColorRect" type="ColorRect" parent="Camera2D"]
visible = false
z_index = 50
offset_left = -3995.0
offset_top = -1678.0
offset_right = 3965.0
offset_bottom = 1594.0
mouse_filter = 1
color = Color(0, 0, 0, 1)
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
z_index = 25
position = Vector2(0, 2)
+7 -2
View File
@@ -1,7 +1,7 @@
extends CharacterBody2D
@onready var animated_sprite_2d = $AnimatedSprite2D
@onready var camera_2d = $Camera2D
@onready var color_rect = $Camera2D/ColorRect
@onready var camera_2d = %Camera2D
@onready var color_rect = %ColorRect
@onready var pipe_timer = $pipe_timer
@onready var pipe_timer_half = $pipe_timer_half
@onready var coin_amt = $CanvasLayer/Control/CoinAmt
@@ -73,6 +73,11 @@ func _ready():
collision_shape_2d.shape.height = 15
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
# set camera
if position.y <= 32:
camera_2d.limit_bottom = 32