Dirty hack to make cameras not affect player just after spawning
This commit is contained in:
parent
08799ec167
commit
c43a0ef9e7
|
@ -28,6 +28,10 @@ var look_aside_speed_curve: Curve
|
||||||
var camera_transition_time_tmp := 0.0
|
var camera_transition_time_tmp := 0.0
|
||||||
var camera_original_position := Vector2.ZERO
|
var camera_original_position := Vector2.ZERO
|
||||||
|
|
||||||
|
const INIT_GRACE_TRANSITION_WINDOW := 0.1
|
||||||
|
# The time node has spent processing
|
||||||
|
var time_processing := 0.0
|
||||||
|
|
||||||
var looking_right := true
|
var looking_right := true
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
|
@ -39,6 +43,8 @@ func _ready():
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(delta: float):
|
func _physics_process(delta: float):
|
||||||
|
time_processing += delta
|
||||||
|
|
||||||
if look_aside_enabled:
|
if look_aside_enabled:
|
||||||
var target_pos = look_aside if looking_right else - look_aside
|
var target_pos = look_aside if looking_right else - look_aside
|
||||||
var curve_x = abs(target_pos - position.x) / (look_aside * 2)
|
var curve_x = abs(target_pos - position.x) / (look_aside * 2)
|
||||||
|
@ -87,8 +93,9 @@ func remove_camera(c):
|
||||||
camera_stack.erase(c)
|
camera_stack.erase(c)
|
||||||
|
|
||||||
func transition(_c):
|
func transition(_c):
|
||||||
camera_transition_time_tmp = camera_transition_time
|
if time_processing >= INIT_GRACE_TRANSITION_WINDOW:
|
||||||
camera_original_position = get_screen_center_position()
|
camera_transition_time_tmp = camera_transition_time
|
||||||
|
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):
|
||||||
|
|
|
@ -356,7 +356,7 @@ position = Vector2(3, -78)
|
||||||
metadata/LayerScrollScale = 3.0
|
metadata/LayerScrollScale = 3.0
|
||||||
|
|
||||||
[node name="Player" parent="." instance=ExtResource("1_abwpk")]
|
[node name="Player" parent="." instance=ExtResource("1_abwpk")]
|
||||||
position = Vector2(-36, -80)
|
position = Vector2(3543, 192)
|
||||||
|
|
||||||
[node name="Platforms" type="Node2D" parent="."]
|
[node name="Platforms" type="Node2D" parent="."]
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ size = Vector2(77.5, 1057)
|
||||||
editor_description = "No fancy graphics stuff here!"
|
editor_description = "No fancy graphics stuff here!"
|
||||||
|
|
||||||
[node name="Player" parent="." instance=ExtResource("2_8ykds")]
|
[node name="Player" parent="." instance=ExtResource("2_8ykds")]
|
||||||
position = Vector2(1065, -412)
|
position = Vector2(2495, -431)
|
||||||
|
|
||||||
[node name="amongus" type="CanvasLayer" parent="."]
|
[node name="amongus" type="CanvasLayer" parent="."]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue