Reset camera position smoothing without smoothing when loading a entrypoint

This commit is contained in:
ChaoticByte 2024-10-03 10:45:49 +02:00
parent 82034a09b4
commit baf7fdc069
No known key found for this signature in database
4 changed files with 6 additions and 1 deletions

View file

@ -29,7 +29,7 @@ var MENU_SCENE: PackedScene = preload("res://menu/menu.tscn")
var ENTRYPOINTS = {
"intro_start": Entrypoint.new("intro", Vector2(0, 0)),
"test": Entrypoint.new("test", Vector2(0, 200), false, Vector2(0, -500)),
"test": Entrypoint.new("test", Vector2(1680, 200), false, Vector2(0, -500)),
}
# load that stuff
@ -73,6 +73,7 @@ func load_entrypoint(ep_name: String) -> bool: # returns true on success
var e: Entrypoint = ENTRYPOINTS[ep_name]
if load_scene(e.scene_name):
NodeRegistry.player.position = e.player_position
NodeRegistry.player.camera.call_deferred("reset_smoothing")
if not e.keep_velocity or NodeRegistry.player.velocity == Vector2.ZERO:
NodeRegistry.player.velocity = e.initial_velocity
Gamestate.last_entrypoint = ep_name

View file

@ -4,6 +4,7 @@
[ext_resource type="PackedScene" uid="uid://b8cjp6hiqycxe" path="res://core/rain.tscn" id="2_31352"]
[node name="Test" type="Node2D"]
position = Vector2(1680, 80)
[node name="StaticBody2D" type="StaticBody2D" parent="."]

View file

@ -1,5 +1,7 @@
extends CharacterBody2D
@onready var camera = $Camera2D
# die
func die():

View file

@ -17,6 +17,7 @@ process_callback = 0
position_smoothing_enabled = true
drag_horizontal_enabled = true
drag_vertical_enabled = true
editor_draw_drag_margin = true
[node name="LightOccluder2D" type="LightOccluder2D" parent="."]
occluder = SubResource("OccluderPolygon2D_p33ik")