Made transitions between cameras based on the screens real coordinates
This commit is contained in:
parent
4d87d3ae84
commit
bb031edd82
|
@ -22,7 +22,7 @@ func _ready():
|
||||||
if follow_camera != null:
|
if follow_camera != null:
|
||||||
camera_stack.append(follow_camera)
|
camera_stack.append(follow_camera)
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float):
|
||||||
# Camera updates
|
# Camera updates
|
||||||
camera_transition_time_tmp -= delta
|
camera_transition_time_tmp -= delta
|
||||||
if camera_transition_time_tmp <= 0.0:
|
if camera_transition_time_tmp <= 0.0:
|
||||||
|
@ -56,7 +56,7 @@ func remove_camera(c):
|
||||||
|
|
||||||
func transition(_c):
|
func transition(_c):
|
||||||
camera_transition_time_tmp = camera_transition_time
|
camera_transition_time_tmp = camera_transition_time
|
||||||
camera_original_position = global_position
|
camera_original_position = get_screen_center_position()
|
||||||
|
|
||||||
# Recursively go through stack to inherit property
|
# Recursively go through stack to inherit property
|
||||||
func try_inherit(enable_property, property):
|
func try_inherit(enable_property, property):
|
||||||
|
|
|
@ -252,6 +252,7 @@ inherit_limit = true
|
||||||
|
|
||||||
[node name="Camera" type="Camera2D" parent="Detatch" node_paths=PackedStringArray("follow_camera") groups=["flip_me"]]
|
[node name="Camera" type="Camera2D" parent="Detatch" node_paths=PackedStringArray("follow_camera") groups=["flip_me"]]
|
||||||
process_callback = 0
|
process_callback = 0
|
||||||
|
limit_smoothed = true
|
||||||
position_smoothing_enabled = true
|
position_smoothing_enabled = true
|
||||||
editor_draw_screen = false
|
editor_draw_screen = false
|
||||||
script = ExtResource("18_kiohe")
|
script = ExtResource("18_kiohe")
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
[gd_scene load_steps=9 format=4 uid="uid://bepys2yg3mlfh"]
|
[gd_scene load_steps=10 format=4 uid="uid://bepys2yg3mlfh"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://bgw5itdndav4s" path="res://icon.svg" id="1_r51fb"]
|
[ext_resource type="Texture2D" uid="uid://bgw5itdndav4s" path="res://icon.svg" id="1_r51fb"]
|
||||||
[ext_resource type="Script" path="res://global/SceneCamera.gd" id="2_7hrj7"]
|
[ext_resource type="Script" path="res://global/SceneCamera.gd" id="2_7hrj7"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dlyt5o2dona1a" path="res://player/Player.tscn" id="2_8ykds"]
|
[ext_resource type="PackedScene" uid="uid://dlyt5o2dona1a" path="res://player/Player.tscn" id="2_8ykds"]
|
||||||
[ext_resource type="Script" path="res://global/FocusZone.gd" id="3_c8r6w"]
|
[ext_resource type="Script" path="res://global/FocusZone.gd" id="3_c8r6w"]
|
||||||
[ext_resource type="Script" path="res://player/ExtendedCamera.gd" id="3_mi107"]
|
[ext_resource type="Script" path="res://player/ExtendedCamera.gd" id="3_mi107"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://3hyrbswjn4e" path="res://expressive_stone.png" id="6_3t7se"]
|
||||||
|
|
||||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_v18bm"]
|
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_v18bm"]
|
||||||
texture = ExtResource("1_r51fb")
|
texture = ExtResource("1_r51fb")
|
||||||
|
@ -30,7 +31,8 @@ tile_set = SubResource("TileSet_v0hen")
|
||||||
[node name="SceneCamera" type="Camera2D" parent="."]
|
[node name="SceneCamera" type="Camera2D" parent="."]
|
||||||
position = Vector2(1460, 976)
|
position = Vector2(1460, 976)
|
||||||
enabled = false
|
enabled = false
|
||||||
limit_bottom = 1080
|
limit_left = -300
|
||||||
|
limit_bottom = 1174
|
||||||
editor_draw_screen = false
|
editor_draw_screen = false
|
||||||
editor_draw_limits = true
|
editor_draw_limits = true
|
||||||
script = ExtResource("2_7hrj7")
|
script = ExtResource("2_7hrj7")
|
||||||
|
@ -49,6 +51,7 @@ enabled = false
|
||||||
limit_smoothed = true
|
limit_smoothed = true
|
||||||
script = ExtResource("3_mi107")
|
script = ExtResource("3_mi107")
|
||||||
inherit_position = true
|
inherit_position = true
|
||||||
|
inherit_limit = true
|
||||||
|
|
||||||
[node name="Enter" type="Area2D" parent="CameraFocusZone"]
|
[node name="Enter" type="Area2D" parent="CameraFocusZone"]
|
||||||
collision_layer = 0
|
collision_layer = 0
|
||||||
|
@ -66,5 +69,10 @@ collision_mask = 4
|
||||||
position = Vector2(746, 388)
|
position = Vector2(746, 388)
|
||||||
shape = SubResource("RectangleShape2D_h3vqu")
|
shape = SubResource("RectangleShape2D_h3vqu")
|
||||||
|
|
||||||
|
[node name="ExpressiveStone" type="Sprite2D" parent="."]
|
||||||
|
position = Vector2(1685, 480)
|
||||||
|
scale = Vector2(4.65625, 1.4375)
|
||||||
|
texture = ExtResource("6_3t7se")
|
||||||
|
|
||||||
[connection signal="body_entered" from="CameraFocusZone/Enter" to="CameraFocusZone" method="focus"]
|
[connection signal="body_entered" from="CameraFocusZone/Enter" to="CameraFocusZone" method="focus"]
|
||||||
[connection signal="body_entered" from="CameraFocusZone/Exit" to="CameraFocusZone" method="stop_focus"]
|
[connection signal="body_entered" from="CameraFocusZone/Exit" to="CameraFocusZone" method="stop_focus"]
|
||||||
|
|
Loading…
Reference in a new issue