transitions "working" in test_bad_performance
This commit is contained in:
parent
7b3c9769a5
commit
a019cd1d6b
7 changed files with 33 additions and 45 deletions
|
@ -29,7 +29,7 @@ func _update_anim_vars():
|
|||
falling = velocity.y > 0
|
||||
on_floor = is_on_floor()
|
||||
on_wall = is_on_wall()
|
||||
y_pan = follow_camera.y_camera_pan
|
||||
y_pan = camera.y_camera_pan
|
||||
dashing = stm.state.name == "Dash"
|
||||
|
||||
## Will set an animation flag that will be unset after a short while
|
||||
|
@ -51,9 +51,7 @@ func current_state():
|
|||
@onready var animation_player = $AnimationPlayer
|
||||
@onready var animation_tree = $AnimationTree
|
||||
@onready var player_character_sprite = $PlayerCharacterSprite
|
||||
@onready var camera = $Detatch/Camera
|
||||
@onready var dev_camera = $Detatch/DevCamera
|
||||
@onready var follow_camera = $FollowCamera
|
||||
@onready var camera = $PlayerCamera
|
||||
@onready var air = $StateMachine/Air
|
||||
@onready var run = $StateMachine/Run
|
||||
@onready var dash = $StateMachine/Dash
|
||||
|
@ -173,7 +171,7 @@ func update_looking_right():
|
|||
looking_right = false
|
||||
if input_dir.x > 0:
|
||||
looking_right = true
|
||||
follow_camera.looking_right = looking_right
|
||||
camera.looking_right = looking_right
|
||||
|
||||
func update_camera_pan(delta: float):
|
||||
if current_state() in [run]:
|
||||
|
@ -181,15 +179,15 @@ func update_camera_pan(delta: float):
|
|||
y_camera_pan_delay_tmp -= delta
|
||||
else:
|
||||
y_camera_pan_delay_tmp = y_camera_pan_delay
|
||||
follow_camera.y_camera_pan = 0
|
||||
follow_camera.y_camera_pan =\
|
||||
camera.y_camera_pan = 0
|
||||
camera.y_camera_pan =\
|
||||
Input.get_action_strength("pan_camera_down") -\
|
||||
Input.get_action_strength("pan_camera_up")
|
||||
if y_camera_pan_delay_tmp <= 0:
|
||||
follow_camera.y_camera_pan = input_dir.y
|
||||
camera.y_camera_pan = input_dir.y
|
||||
else:
|
||||
y_camera_pan_delay_tmp = y_camera_pan_delay
|
||||
follow_camera.y_camera_pan = 0
|
||||
camera.y_camera_pan = 0
|
||||
|
||||
|
||||
func _update_input():
|
||||
|
@ -378,10 +376,12 @@ func _physics_process(delta):
|
|||
if Input.is_action_just_pressed("debug_toggle_dev_camera"):
|
||||
if !debug_dev_camera_active:
|
||||
debug_dev_camera_active = true
|
||||
camera.apply_camera(dev_camera)
|
||||
# TODO update this
|
||||
#camera.apply_camera(dev_camera)
|
||||
else:
|
||||
debug_dev_camera_active = false
|
||||
camera.remove_camera(dev_camera)
|
||||
# TODO update this
|
||||
#camera.remove_camera(dev_camera)
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
fade_to_black.color.a += (1 if fading else -1) * delta / current_fade_time
|
||||
|
@ -442,7 +442,7 @@ func remove_camera(c):
|
|||
camera.remove_camera(c)
|
||||
|
||||
func reset_camera():
|
||||
camera.reset_camera()
|
||||
camera.reset_smoothing()
|
||||
|
||||
func enable_camera(enable: bool):
|
||||
camera.enabled = enable
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=338 format=3 uid="uid://dlyt5o2dona1a"]
|
||||
[gd_scene load_steps=337 format=3 uid="uid://dlyt5o2dona1a"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://d1de5fg4m1l34" path="res://characters/player/Player.gd" id="1_l3wc5"]
|
||||
[ext_resource type="Script" uid="uid://bgvnlvv0wk71g" path="res://global/state_machine/StateMachine.gd" id="2_ae3rk"]
|
||||
|
@ -79,9 +79,8 @@
|
|||
[ext_resource type="Texture2D" uid="uid://dnixehn6vw3cj" path="res://characters/player/assets/wavedash/wavedash_L.png" id="56_ebbxk"]
|
||||
[ext_resource type="Texture2D" uid="uid://c30q7ol4u8mef" path="res://characters/player/assets/wavedash/wavedash_R.png" id="57_7cktu"]
|
||||
[ext_resource type="Script" uid="uid://ddhsdf13or1da" path="res://global/state_machine/misc/JumpStats.gd" id="64_5bsmn"]
|
||||
[ext_resource type="Script" uid="uid://dmhg22cbt8m0l" path="res://global/camera/CameraProperties.gd" id="64_wa5ni"]
|
||||
[ext_resource type="Script" uid="uid://cwul8pyopo3co" path="res://global/camera/PlayerCamera.gd" id="65_5brr7"]
|
||||
[ext_resource type="Curve" uid="uid://ojnqamky0j8r" path="res://global/camera/default-camera-transition-curve.tres" id="65_p83q2"]
|
||||
[ext_resource type="PackedScene" uid="uid://d0wkusth6nbhh" path="res://global/camera/CameraProperties.tscn" id="66_8qlk8"]
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_4lqx6"]
|
||||
animations = [{
|
||||
|
@ -3278,12 +3277,7 @@ enabled = true
|
|||
fallback_properties = NodePath("../CameraProperties")
|
||||
look_aside_speed_curve = SubResource("Curve_5brr7")
|
||||
|
||||
[node name="CameraProperties" type="Node2D" parent="."]
|
||||
script = ExtResource("64_wa5ni")
|
||||
transform_curve = ExtResource("65_p83q2")
|
||||
limits_curve = ExtResource("65_p83q2")
|
||||
smoothing_curve = ExtResource("65_p83q2")
|
||||
limit_left = 0
|
||||
[node name="CameraProperties" parent="." instance=ExtResource("66_8qlk8")]
|
||||
|
||||
[node name="UI" type="CanvasLayer" parent="."]
|
||||
layer = 3
|
||||
|
|
|
@ -1,20 +1,10 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://dfeledodwea5b"]
|
||||
[gd_scene load_steps=2 format=3 uid="uid://dfeledodwea5b"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://rvypec07l773" path="res://global/camera/CameraFocuser.gd" id="1_mwx4y"]
|
||||
[ext_resource type="Script" uid="uid://cx3oein6oqpdq" path="res://global/camera/ExtendedCamera.gd" id="3_fq11f"]
|
||||
|
||||
[node name="CameraFocusZone" type="Node2D" node_paths=PackedStringArray("camera")]
|
||||
[node name="CameraFocusZone" type="Node2D"]
|
||||
editor_description = "Enable editable children, then add collision shapes to the enter and exit zone."
|
||||
script = ExtResource("1_mwx4y")
|
||||
camera = NodePath("Camera")
|
||||
|
||||
[node name="Camera" type="Camera2D" parent="."]
|
||||
scale = Vector2(1, 1)
|
||||
enabled = false
|
||||
limit_smoothed = true
|
||||
editor_draw_limits = true
|
||||
script = ExtResource("3_fq11f")
|
||||
inherit_position = true
|
||||
|
||||
[node name="Enter" type="Area2D" parent="."]
|
||||
collision_layer = 0
|
||||
|
|
|
@ -2,7 +2,7 @@ extends Node
|
|||
|
||||
## Applies camera when focus is called, removes camera when stop_focus is called.
|
||||
|
||||
@export var camera: ExtendedCamera
|
||||
@export var camera: CameraProperties
|
||||
|
||||
func focus(actor):
|
||||
actor.apply_camera(camera)
|
||||
|
|
10
project2-godot/global/camera/CameraProperties.tscn
Normal file
10
project2-godot/global/camera/CameraProperties.tscn
Normal file
|
@ -0,0 +1,10 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://d0wkusth6nbhh"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dmhg22cbt8m0l" path="res://global/camera/CameraProperties.gd" id="1_ur3fr"]
|
||||
[ext_resource type="Curve" uid="uid://ojnqamky0j8r" path="res://global/camera/default-camera-transition-curve.tres" id="2_6itet"]
|
||||
|
||||
[node name="CameraProperties" type="Node2D"]
|
||||
script = ExtResource("1_ur3fr")
|
||||
transform_curve = ExtResource("2_6itet")
|
||||
limits_curve = ExtResource("2_6itet")
|
||||
smoothing_curve = ExtResource("2_6itet")
|
|
@ -100,7 +100,7 @@ func remove_camera(c):
|
|||
var op = func(): camera_stack.erase(c)
|
||||
_reset(op)
|
||||
|
||||
func add_camera(c):
|
||||
func apply_camera(c):
|
||||
var op = func(): camera_stack.push_back(c)
|
||||
_reset(op)
|
||||
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
[ext_resource type="Texture2D" uid="uid://b1ctnt3wnsgj4" path="res://icon.svg" id="1_r51fb"]
|
||||
[ext_resource type="Script" uid="uid://ddk7mcwdblbf" path="res://global/camera/SceneCamera.gd" id="2_7hrj7"]
|
||||
[ext_resource type="PackedScene" uid="uid://b2awe6tx7xq0c" path="res://global/scene_transition/SceneTransition.tscn" id="2_uhdkp"]
|
||||
[ext_resource type="Script" uid="uid://cx3oein6oqpdq" path="res://global/camera/ExtendedCamera.gd" id="3_mi107"]
|
||||
[ext_resource type="PackedScene" uid="uid://dfeledodwea5b" path="res://global/camera/CameraFocusZone.tscn" id="4_dn1o1"]
|
||||
[ext_resource type="Shader" uid="uid://tibpqmkay46y" path="res://debug/shaders/wobbly.gdshader" id="4_o1bhb"]
|
||||
[ext_resource type="Texture2D" uid="uid://tfth34htn52n" path="res://expressive_stone.png" id="6_3t7se"]
|
||||
[ext_resource type="PackedScene" uid="uid://d0wkusth6nbhh" path="res://global/camera/CameraProperties.tscn" id="6_tdtq1"]
|
||||
[ext_resource type="PackedScene" uid="uid://sxcxj2sua5ho" path="res://characters/enemies/Bingus/Bingus.tscn" id="8_puapy"]
|
||||
[ext_resource type="PackedScene" uid="uid://dwg8c17nqiep2" path="res://global/powerups/Powerup.tscn" id="9_r6xmg"]
|
||||
[ext_resource type="PackedScene" uid="uid://bkh0o0gbpctui" path="res://global/saving/SaveSpot.tscn" id="10_tdtq1"]
|
||||
|
@ -78,17 +78,11 @@ position = Vector2(3196.75, -307)
|
|||
scale = Vector2(14.3203, 7.0625)
|
||||
texture = ExtResource("6_3t7se")
|
||||
|
||||
[node name="Camera" type="Camera2D" parent="ExpressiveStone"]
|
||||
position = Vector2(1.71811, 6.95651)
|
||||
scale = Vector2(0.214765, 0.695652)
|
||||
enabled = false
|
||||
limit_smoothed = true
|
||||
editor_draw_limits = true
|
||||
script = ExtResource("3_mi107")
|
||||
inherit_position = true
|
||||
[node name="CameraProperties" parent="ExpressiveStone" instance=ExtResource("6_tdtq1")]
|
||||
|
||||
[node name="CameraFocusZone" parent="." instance=ExtResource("4_dn1o1")]
|
||||
[node name="CameraFocusZone" parent="." node_paths=PackedStringArray("camera") instance=ExtResource("4_dn1o1")]
|
||||
position = Vector2(3043, -274)
|
||||
camera = NodePath("../ExpressiveStone/CameraProperties")
|
||||
|
||||
[node name="Shape" type="CollisionShape2D" parent="CameraFocusZone/Enter" index="0"]
|
||||
position = Vector2(-2002.75, 669)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue