跳跃手感优化
This commit is contained in:
parent
fa94dd8006
commit
6383432bbe
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=43 format=3 uid="uid://gwhff4qaouxy"]
|
[gd_scene load_steps=41 format=3 uid="uid://gwhff4qaouxy"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://dq1g1qp66chwy" path="res://_player/avatar.gd" id="1_rkqpu"]
|
[ext_resource type="Script" uid="uid://dq1g1qp66chwy" path="res://_player/avatar.gd" id="1_rkqpu"]
|
||||||
[ext_resource type="Script" uid="uid://isu8onknb75o" path="res://_player/states/character_state_machine.gd" id="1_wvs5h"]
|
[ext_resource type="Script" uid="uid://isu8onknb75o" path="res://_player/states/character_state_machine.gd" id="1_wvs5h"]
|
||||||
|
|
@ -33,10 +33,8 @@
|
||||||
[ext_resource type="Resource" uid="uid://do0bnwse614jw" path="res://_player/effect_binding/land_dust.tres" id="26_s5egm"]
|
[ext_resource type="Resource" uid="uid://do0bnwse614jw" path="res://_player/effect_binding/land_dust.tres" id="26_s5egm"]
|
||||||
[ext_resource type="Script" uid="uid://bijoqygv6tncj" path="res://addons/reedcomponent/SingleComponentRemotor.gd" id="28_mxt3b"]
|
[ext_resource type="Script" uid="uid://bijoqygv6tncj" path="res://addons/reedcomponent/SingleComponentRemotor.gd" id="28_mxt3b"]
|
||||||
[ext_resource type="Resource" uid="uid://bdad4yjv1q0uu" path="res://_player/effect_binding/jump_dust.tres" id="30_hquoe"]
|
[ext_resource type="Resource" uid="uid://bdad4yjv1q0uu" path="res://_player/effect_binding/jump_dust.tres" id="30_hquoe"]
|
||||||
[ext_resource type="Script" uid="uid://bhd4nuiu23e7l" path="res://addons/phantom_camera/scripts/phantom_camera/phantom_camera_noise_emitter_2d.gd" id="32_ciuu3"]
|
|
||||||
[ext_resource type="Script" uid="uid://bhexx6mj1xv3q" path="res://addons/phantom_camera/scripts/phantom_camera/phantom_camera_2d.gd" id="32_u7cua"]
|
[ext_resource type="Script" uid="uid://bhexx6mj1xv3q" path="res://addons/phantom_camera/scripts/phantom_camera/phantom_camera_2d.gd" id="32_u7cua"]
|
||||||
[ext_resource type="Script" uid="uid://bueehfgv5vnc0" path="res://_player/extra/camera_priority_locker.gd" id="34_1a1t3"]
|
[ext_resource type="Script" uid="uid://bueehfgv5vnc0" path="res://_player/extra/camera_priority_locker.gd" id="34_1a1t3"]
|
||||||
[ext_resource type="Resource" uid="uid://dy1hsviasxfu0" path="res://_shared/camera/camera_shake/base_noise.tres" id="34_01uoa"]
|
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_1a1t3"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_1a1t3"]
|
||||||
radius = 3.0
|
radius = 3.0
|
||||||
|
|
@ -197,20 +195,11 @@ script = ExtResource("24_mwlgv")
|
||||||
bindings = Array[ExtResource("25_s5egm")]([ExtResource("26_s5egm"), ExtResource("30_hquoe")])
|
bindings = Array[ExtResource("25_s5egm")]([ExtResource("26_s5egm"), ExtResource("30_hquoe")])
|
||||||
metadata/_custom_type_script = "uid://ta2r2bc1nrwe"
|
metadata/_custom_type_script = "uid://ta2r2bc1nrwe"
|
||||||
|
|
||||||
[node name="PhantomCameraNoiseEmitter2D" type="Node2D" parent="."]
|
|
||||||
unique_name_in_owner = true
|
|
||||||
script = ExtResource("32_ciuu3")
|
|
||||||
noise = ExtResource("34_01uoa")
|
|
||||||
duration = 0.2
|
|
||||||
noise_emitter_layer = 0
|
|
||||||
metadata/_custom_type_script = "uid://bhd4nuiu23e7l"
|
|
||||||
|
|
||||||
[node name="PhantomCamera2D" type="Node2D" parent="."]
|
[node name="PhantomCamera2D" type="Node2D" parent="."]
|
||||||
position = Vector2(50, -75)
|
position = Vector2(50, -75)
|
||||||
script = ExtResource("32_u7cua")
|
script = ExtResource("32_u7cua")
|
||||||
tween_resource = SubResource("Resource_1a1t3")
|
tween_resource = SubResource("Resource_1a1t3")
|
||||||
draw_limits = true
|
draw_limits = true
|
||||||
noise = ExtResource("34_01uoa")
|
|
||||||
metadata/_custom_type_script = "uid://bhexx6mj1xv3q"
|
metadata/_custom_type_script = "uid://bhexx6mj1xv3q"
|
||||||
|
|
||||||
[node name="Locker" type="Node" parent="PhantomCamera2D" node_paths=PackedStringArray("target_camera")]
|
[node name="Locker" type="Node" parent="PhantomCamera2D" node_paths=PackedStringArray("target_camera")]
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,6 @@ class_name Player extends CharacterBody2D
|
||||||
@onready var foot_pos_marker: Marker2D = %FootPosMarker
|
@onready var foot_pos_marker: Marker2D = %FootPosMarker
|
||||||
@onready var ground_companion: Area2D = %GroundCompanion
|
@onready var ground_companion: Area2D = %GroundCompanion
|
||||||
|
|
||||||
@onready var phantom_camera_noise_emitter_2d: PhantomCameraNoiseEmitter2D = %PhantomCameraNoiseEmitter2D
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
enum Direction{LEFT,RIGHT}
|
enum Direction{LEFT,RIGHT}
|
||||||
var direction: Direction = Direction.RIGHT: set = _player_direction_changed
|
var direction: Direction = Direction.RIGHT: set = _player_direction_changed
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,23 @@ func _enter() -> void:
|
||||||
var tween := get_tree().create_tween()
|
var tween := get_tree().create_tween()
|
||||||
tween.set_ignore_time_scale(true)
|
tween.set_ignore_time_scale(true)
|
||||||
|
|
||||||
tween.tween_property(Engine, "time_scale", .15, .04)
|
tween.tween_property(Engine, "time_scale", .25, .03)
|
||||||
tween.tween_interval(.12)
|
tween.tween_interval(.1)
|
||||||
tween.tween_property(Engine, "time_scale", 1.0, .06)
|
tween.tween_property(Engine, "time_scale", 1.0, .05)
|
||||||
|
|
||||||
agent.phantom_camera_noise_emitter_2d.emit()
|
var hook_inst: Hook = agent.spawn_hook_comp.get_current_hook_inst()
|
||||||
|
if hook_inst:
|
||||||
|
var i = hook_inst.get_direction_id()
|
||||||
|
|
||||||
|
if i >= 0:
|
||||||
|
if i == 0 or i == 4:
|
||||||
|
CameraSystem.get_cached_camera().emit_hook_touch_shock(0)
|
||||||
|
elif i == 1 or i == 5:
|
||||||
|
CameraSystem.get_cached_camera().emit_hook_touch_shock(1)
|
||||||
|
elif i == 2 or i == 6:
|
||||||
|
CameraSystem.get_cached_camera().emit_hook_touch_shock(2)
|
||||||
|
elif i == 3 or i == 7:
|
||||||
|
CameraSystem.get_cached_camera().emit_hook_touch_shock(3)
|
||||||
|
|
||||||
if root.grap_hook_state._jump_grace_timer > 0:
|
if root.grap_hook_state._jump_grace_timer > 0:
|
||||||
_hook_to_jump()
|
_hook_to_jump()
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,8 @@ func register_player_camera(owner: Node) -> GlobalCamera:
|
||||||
func get_cached_camera() -> GlobalCamera:
|
func get_cached_camera() -> GlobalCamera:
|
||||||
return _cached_player_camera
|
return _cached_player_camera
|
||||||
|
|
||||||
|
func get_player_camera() -> GlobalCamera:
|
||||||
|
return _cached_player_camera
|
||||||
|
|
||||||
## 注册一个相机锚点
|
## 注册一个相机锚点
|
||||||
func register_anchor(anchor: CameraAnchor) -> void:
|
func register_anchor(anchor: CameraAnchor) -> void:
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,24 @@
|
||||||
class_name GlobalCamera extends Node2D
|
class_name GlobalCamera extends Node2D
|
||||||
|
|
||||||
@onready var phantom_camera_2d: PhantomCamera2D = %PhantomCamera2D
|
@onready var phantom_camera_2d: PhantomCamera2D = %PhantomCamera2D
|
||||||
@onready var phantom_camera_noise_emitter_2d: PhantomCameraNoiseEmitter2D = %PhantomCameraNoiseEmitter2D
|
|
||||||
|
@onready var _0_hook_touch_noise: PhantomCameraNoiseEmitter2D = %"0_Hook_Touch_Noise"
|
||||||
|
@onready var _45_hook_touch_noise: PhantomCameraNoiseEmitter2D = %"45_Hook_Touch_Noise"
|
||||||
|
@onready var _90_hook_touch_noise: PhantomCameraNoiseEmitter2D = %"90_Hook_Touch_Noise"
|
||||||
|
@onready var _135_hook_touch_noise: PhantomCameraNoiseEmitter2D = %"135_Hook_Touch_Noise"
|
||||||
|
|
||||||
|
|
||||||
|
func emit_camera_shock(noise: PhantomCameraNoise2D) -> void:
|
||||||
|
if not noise:
|
||||||
|
return
|
||||||
|
|
||||||
|
func emit_hook_touch_shock(dir : int) -> void:
|
||||||
|
match dir:
|
||||||
|
0:
|
||||||
|
_0_hook_touch_noise.emit()
|
||||||
|
1:
|
||||||
|
_45_hook_touch_noise.emit()
|
||||||
|
2:
|
||||||
|
_90_hook_touch_noise.emit()
|
||||||
|
3:
|
||||||
|
_135_hook_touch_noise.emit()
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,47 @@
|
||||||
[gd_scene load_steps=6 format=3 uid="uid://d1w8ftfhxycfy"]
|
[gd_scene load_steps=11 format=3 uid="uid://d1w8ftfhxycfy"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://52tgslofxoi2" path="res://_shared/camera/GlobalCamera.gd" id="1_fixiw"]
|
[ext_resource type="Script" uid="uid://52tgslofxoi2" path="res://_shared/camera/GlobalCamera.gd" id="1_fixiw"]
|
||||||
[ext_resource type="Script" uid="uid://bhexx6mj1xv3q" path="res://addons/phantom_camera/scripts/phantom_camera/phantom_camera_2d.gd" id="1_llsih"]
|
[ext_resource type="Script" uid="uid://bhexx6mj1xv3q" path="res://addons/phantom_camera/scripts/phantom_camera/phantom_camera_2d.gd" id="1_llsih"]
|
||||||
[ext_resource type="Script" uid="uid://bhd4nuiu23e7l" path="res://addons/phantom_camera/scripts/phantom_camera/phantom_camera_noise_emitter_2d.gd" id="3_0bl5s"]
|
[ext_resource type="Script" uid="uid://bhd4nuiu23e7l" path="res://addons/phantom_camera/scripts/phantom_camera/phantom_camera_noise_emitter_2d.gd" id="3_0bl5s"]
|
||||||
[ext_resource type="Script" uid="uid://8umksf8e80fw" path="res://addons/phantom_camera/scripts/resources/tween_resource.gd" id="3_fixiw"]
|
[ext_resource type="Script" uid="uid://8umksf8e80fw" path="res://addons/phantom_camera/scripts/resources/tween_resource.gd" id="3_fixiw"]
|
||||||
|
[ext_resource type="Script" uid="uid://dimvdouy8g0sv" path="res://addons/phantom_camera/scripts/resources/phantom_camera_noise_2d.gd" id="6_ctkin"]
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_pvk7k"]
|
[sub_resource type="Resource" id="Resource_pvk7k"]
|
||||||
script = ExtResource("3_fixiw")
|
script = ExtResource("3_fixiw")
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_jjeqj"]
|
||||||
|
script = ExtResource("6_ctkin")
|
||||||
|
amplitude = 5.0
|
||||||
|
frequency = 18.0
|
||||||
|
randomize_noise_seed = 1
|
||||||
|
noise_seed = 1000
|
||||||
|
positional_multiplier_x = 0.0
|
||||||
|
positional_multiplier_y = 2.0
|
||||||
|
metadata/_custom_type_script = "uid://dimvdouy8g0sv"
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_ctkin"]
|
||||||
|
script = ExtResource("6_ctkin")
|
||||||
|
amplitude = 5.0
|
||||||
|
frequency = 18.0
|
||||||
|
randomize_noise_seed = 1
|
||||||
|
metadata/_custom_type_script = "uid://dimvdouy8g0sv"
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_wjs5j"]
|
||||||
|
script = ExtResource("6_ctkin")
|
||||||
|
amplitude = 5.0
|
||||||
|
frequency = 18.0
|
||||||
|
randomize_noise_seed = 1
|
||||||
|
positional_multiplier_x = 2.0
|
||||||
|
positional_multiplier_y = 0.0
|
||||||
|
metadata/_custom_type_script = "uid://dimvdouy8g0sv"
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_ompnq"]
|
||||||
|
script = ExtResource("6_ctkin")
|
||||||
|
amplitude = 5.0
|
||||||
|
frequency = 18.0
|
||||||
|
randomize_noise_seed = 1
|
||||||
|
metadata/_custom_type_script = "uid://dimvdouy8g0sv"
|
||||||
|
|
||||||
[node name="PlayerStaticCamera" type="Node2D"]
|
[node name="PlayerStaticCamera" type="Node2D"]
|
||||||
script = ExtResource("1_fixiw")
|
script = ExtResource("1_fixiw")
|
||||||
|
|
||||||
|
|
@ -19,9 +53,41 @@ zoom = Vector2(0.8, 0.8)
|
||||||
tween_resource = SubResource("Resource_pvk7k")
|
tween_resource = SubResource("Resource_pvk7k")
|
||||||
tween_on_load = false
|
tween_on_load = false
|
||||||
draw_limits = true
|
draw_limits = true
|
||||||
|
noise_emitter_layer = 1
|
||||||
metadata/_custom_type_script = "uid://bhexx6mj1xv3q"
|
metadata/_custom_type_script = "uid://bhexx6mj1xv3q"
|
||||||
|
|
||||||
[node name="PhantomCameraNoiseEmitter2D" type="Node2D" parent="PhantomCamera2D"]
|
[node name="0_Hook_Touch_Noise" type="Node2D" parent="PhantomCamera2D"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
script = ExtResource("3_0bl5s")
|
script = ExtResource("3_0bl5s")
|
||||||
|
noise = SubResource("Resource_jjeqj")
|
||||||
|
growth_time = 0.04095982
|
||||||
|
duration = 0.16
|
||||||
|
decay_time = 0.10085586
|
||||||
|
metadata/_custom_type_script = "uid://bhd4nuiu23e7l"
|
||||||
|
|
||||||
|
[node name="45_Hook_Touch_Noise" type="Node2D" parent="PhantomCamera2D"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
script = ExtResource("3_0bl5s")
|
||||||
|
noise = SubResource("Resource_ctkin")
|
||||||
|
growth_time = 0.04096021
|
||||||
|
duration = 0.16
|
||||||
|
decay_time = 0.10085552
|
||||||
|
metadata/_custom_type_script = "uid://bhd4nuiu23e7l"
|
||||||
|
|
||||||
|
[node name="90_Hook_Touch_Noise" type="Node2D" parent="PhantomCamera2D"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
script = ExtResource("3_0bl5s")
|
||||||
|
noise = SubResource("Resource_wjs5j")
|
||||||
|
growth_time = 0.0409602
|
||||||
|
duration = 0.16
|
||||||
|
decay_time = 0.10085564
|
||||||
|
metadata/_custom_type_script = "uid://bhd4nuiu23e7l"
|
||||||
|
|
||||||
|
[node name="135_Hook_Touch_Noise" type="Node2D" parent="PhantomCamera2D"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
script = ExtResource("3_0bl5s")
|
||||||
|
noise = SubResource("Resource_ompnq")
|
||||||
|
growth_time = 0.040960066
|
||||||
|
duration = 0.16
|
||||||
|
decay_time = 0.100856625
|
||||||
metadata/_custom_type_script = "uid://bhd4nuiu23e7l"
|
metadata/_custom_type_script = "uid://bhd4nuiu23e7l"
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,6 @@ script = ExtResource("1_oi7x7")
|
||||||
amplitude = 8.0
|
amplitude = 8.0
|
||||||
frequency = 15.0
|
frequency = 15.0
|
||||||
randomize_noise_seed = 1
|
randomize_noise_seed = 1
|
||||||
noise_seed = 896
|
noise_seed = 608
|
||||||
positional_multiplier_y = 2.0
|
positional_multiplier_y = 2.0
|
||||||
metadata/_custom_type_script = "uid://dimvdouy8g0sv"
|
metadata/_custom_type_script = "uid://dimvdouy8g0sv"
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -25,6 +25,8 @@ var _cached_cancel := false
|
||||||
var _current_length := 0.0
|
var _current_length := 0.0
|
||||||
var _anchor: Node2D
|
var _anchor: Node2D
|
||||||
|
|
||||||
|
var _dir_id: int = -1
|
||||||
|
|
||||||
# =================
|
# =================
|
||||||
# Life Cycle
|
# Life Cycle
|
||||||
# =================
|
# =================
|
||||||
|
|
@ -49,6 +51,8 @@ func start_stretching(direction: Vector2) -> void:
|
||||||
_stretching_dir = direction.normalized()
|
_stretching_dir = direction.normalized()
|
||||||
_current_length = 0.0
|
_current_length = 0.0
|
||||||
|
|
||||||
|
_dir_id = _get_direction_id(direction,8)
|
||||||
|
|
||||||
func end_stretching(force_end: bool = false) -> bool:
|
func end_stretching(force_end: bool = false) -> bool:
|
||||||
if not force_end and _is_stretching:
|
if not force_end and _is_stretching:
|
||||||
if _current_length < min_length:
|
if _current_length < min_length:
|
||||||
|
|
@ -157,3 +161,23 @@ func _create_anchor_on_node(target: Node2D, hit_global_pos: Vector2) -> Node2D:
|
||||||
_anchor.position = target.to_local(hit_global_pos)
|
_anchor.position = target.to_local(hit_global_pos)
|
||||||
|
|
||||||
return _anchor
|
return _anchor
|
||||||
|
|
||||||
|
## 计算方向id,私有
|
||||||
|
func _get_direction_id(direction: Vector2, sector_count: int) -> int:
|
||||||
|
if direction == Vector2.ZERO:
|
||||||
|
return -1
|
||||||
|
|
||||||
|
var angle = rad_to_deg(direction.angle())
|
||||||
|
|
||||||
|
angle += 90.0
|
||||||
|
|
||||||
|
var sector_size = 360.0 / sector_count
|
||||||
|
angle += sector_size / 2.0
|
||||||
|
|
||||||
|
angle = fposmod(angle, 360.0)
|
||||||
|
|
||||||
|
return int(angle / sector_size)
|
||||||
|
|
||||||
|
## 获取方向id
|
||||||
|
func get_direction_id() -> int:
|
||||||
|
return _dir_id
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,9 @@ func release_cached_hook() -> void:
|
||||||
if _current_grap_hook_inst:
|
if _current_grap_hook_inst:
|
||||||
_current_grap_hook_inst.release_hook()
|
_current_grap_hook_inst.release_hook()
|
||||||
|
|
||||||
|
func get_current_hook_inst() -> Hook:
|
||||||
|
return _current_grap_hook_inst
|
||||||
|
|
||||||
##尝试关闭hook的延长
|
##尝试关闭hook的延长
|
||||||
func suspend_hook_stretching(force_suspend: bool = false) -> bool:
|
func suspend_hook_stretching(force_suspend: bool = false) -> bool:
|
||||||
if not _current_grap_hook_inst: return false
|
if not _current_grap_hook_inst: return false
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue