Compare commits

...

8 Commits

Author SHA1 Message Date
Reed fd64d64adf 新视角下角色钩锁修正 2026-01-16 17:23:58 +08:00
Valerie ed424fc250 tilemap 2026-01-16 15:03:29 +08:00
Reed 16c3204375 Merge branch 'main' of http://47.99.99.211:3000/ReedZhu/godot-plateformer
OK
2026-01-16 14:16:36 +08:00
Reed a16ab33e4f 角色跳跃数据迭代 2026-01-16 14:16:25 +08:00
Valerie a7fbcfe7a6 character02 2026-01-16 14:15:33 +08:00
Valerie ddd50c9d5f new character and tile 2026-01-16 13:46:15 +08:00
Reed 11fc120236 新地图tile 规格测试 2026-01-16 13:22:02 +08:00
Valerie 00bd30e3b4 collisionTile 2026-01-16 10:51:56 +08:00
25 changed files with 694 additions and 139 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

BIN
_asset/ksw/character01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View File

@ -2,16 +2,16 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://dted7geb331y2"
path="res://.godot/imported/character.png-7c44b4524e7faa111c3b7a3476538724.ctex"
uid="uid://bryuhk1hqe4hh"
path="res://.godot/imported/character01.png-4ae759f7a7c8b54af8e62bf3e502a8de.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://_asset/ksw/character.png"
dest_files=["res://.godot/imported/character.png-7c44b4524e7faa111c3b7a3476538724.ctex"]
source_file="res://_asset/ksw/character01.png"
dest_files=["res://.godot/imported/character01.png-4ae759f7a7c8b54af8e62bf3e502a8de.ctex"]
[params]

BIN
_asset/ksw/character02.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View File

@ -2,16 +2,16 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://cw1lcd672mq87"
path="res://.godot/imported/未命名作品(3).png-5152e47ab8192492e0d911592bc8c8f5.ctex"
uid="uid://b4k06j8chs2el"
path="res://.godot/imported/character02.png-17a0c468b9f208a10603c306ed77416b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://_asset/ksw/未命名作品(3).png"
dest_files=["res://.godot/imported/未命名作品(3).png-5152e47ab8192492e0d911592bc8c8f5.ctex"]
source_file="res://_asset/ksw/character02.png"
dest_files=["res://.godot/imported/character02.png-17a0c468b9f208a10603c306ed77416b.ctex"]
[params]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

BIN
_asset/ksw/tile/tile.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

View File

@ -2,16 +2,16 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://cfjprjiin3dnk"
path="res://.godot/imported/normal.png-2812748d0b3fe0e26bf430a863bce9c7.ctex"
uid="uid://ntm66vo10u2q"
path="res://.godot/imported/tile.png-289c3a7c75eaae83df78711948565daf.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://_asset/ksw/normal.png"
dest_files=["res://.godot/imported/normal.png-2812748d0b3fe0e26bf430a863bce9c7.ctex"]
source_file="res://_asset/ksw/tile/tile.png"
dest_files=["res://.godot/imported/tile.png-289c3a7c75eaae83df78711948565daf.ctex"]
[params]

BIN
_asset/ksw/tile/tile02.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

View File

@ -2,16 +2,16 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://dkip6i0oyhnlx"
path="res://.godot/imported/damage.png-75c6a469140d15eab0a2b7301c5e8959.ctex"
uid="uid://cchtbbig85jcm"
path="res://.godot/imported/tile02.png-e8381a8c1a148c3eb8ce3bc8009de863.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://_asset/ksw/damage.png"
dest_files=["res://.godot/imported/damage.png-75c6a469140d15eab0a2b7301c5e8959.ctex"]
source_file="res://_asset/ksw/tile/tile02.png"
dest_files=["res://.godot/imported/tile02.png-e8381a8c1a148c3eb8ce3bc8009de863.ctex"]
[params]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

View File

@ -1,40 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cacik4t6grtq8"
path="res://.godot/imported/未命名作品(4).png-151765b68adadae09c88456ac264362b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://_asset/ksw/未命名作品(4).png"
dest_files=["res://.godot/imported/未命名作品(4).png-151765b68adadae09c88456ac264362b.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

15
_game/GameMainNew.tscn Normal file
View File

@ -0,0 +1,15 @@
[gd_scene load_steps=5 format=3 uid="uid://x041oerqe1iu"]
[ext_resource type="Script" uid="uid://crgac4manhoud" path="res://_game/game.gd" id="1_n75l0"]
[ext_resource type="PackedScene" uid="uid://cvqehvdjpoar4" path="res://_player/player_controller.tscn" id="2_uvy3i"]
[ext_resource type="PackedScene" uid="uid://cw6buluknvjj" path="res://_camera/PlateformerCamera.tscn" id="3_j30v4"]
[ext_resource type="PackedScene" uid="uid://d3x8beboy1e6y" path="res://_scene/level1/l1_s1_new.tscn" id="4_w37b4"]
[node name="Game" type="Node2D" groups=["PLAYER_RESPAWN"]]
script = ExtResource("1_n75l0")
[node name="PlayerController" parent="." instance=ExtResource("2_uvy3i")]
[node name="PlateformerCamera" parent="." instance=ExtResource("3_j30v4")]
[node name="L1_S1" parent="." instance=ExtResource("4_w37b4")]

View File

@ -1,8 +1,8 @@
extends Node2D
func _ready() -> void:
$L0_S0.switch_act_by_id(1)
#$L1_S1.switch_act_by_id(1)
#$L0_S0.switch_act_by_id(1)
$L1_S1.switch_act_by_id(1)
#$L1_S2.switch_act_by_id(1)
#$L1_S3.switch_act_by_id(1)
#$L1_S4.switch_act_by_id(1)

View File

@ -10,7 +10,7 @@
[ext_resource type="Script" uid="uid://b5hkfpjbye70" path="res://_player/states/idle.gd" id="4_30i7g"]
[ext_resource type="BlackboardPlan" uid="uid://nlw7rxugv5uh" path="res://_player/bbp_player.tres" id="4_mwufa"]
[ext_resource type="Resource" uid="uid://cs50mkt830f8r" path="res://_camera/camera_shake/CSP_XY.tres" id="5_ciuu3"]
[ext_resource type="Texture2D" uid="uid://dted7geb331y2" path="res://_asset/ksw/character.png" id="6_01uoa"]
[ext_resource type="Texture2D" uid="uid://bryuhk1hqe4hh" path="res://_asset/ksw/character01.png" id="6_01uoa"]
[ext_resource type="Script" uid="uid://bpd54nf8oxwsb" path="res://_player/states/player_hsm.gd" id="6_8q4ov"]
[ext_resource type="Script" uid="uid://po21boe8iqcc" path="res://_player/states/move.gd" id="7_rrwxs"]
[ext_resource type="Script" uid="uid://cjf7kds0cipkw" path="res://_tools/limbo_state_helper.gd" id="8_clxy3"]
@ -37,14 +37,15 @@
[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"]
[sub_resource type="CircleShape2D" id="CircleShape2D_1a1t3"]
radius = 3.0
[sub_resource type="RectangleShape2D" id="RectangleShape2D_01uoa"]
size = Vector2(173, 50)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_qnulu"]
size = Vector2(9, 11.5)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ciuu3"]
size = Vector2(203, 245)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ogl63"]
size = Vector2(10, 10)
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_ciuu3"]
radius = 134.0
height = 338.0
[node name="Avatar" type="CharacterBody2D" groups=["PLAYER"]]
collision_layer = 2
@ -59,26 +60,25 @@ camera_shake_preset = Dictionary[StringName, ExtResource("2_u7cua")]({
&"y_only_light": ExtResource("4_01uoa")
})
[node name="Sprite2D" type="Sprite2D" parent="."]
position = Vector2(0, 3.9999998)
texture = ExtResource("6_01uoa")
[node name="GroundCompanion" type="Area2D" parent="."]
unique_name_in_owner = true
position = Vector2(0, 11)
position = Vector2(0, 160)
collision_layer = 0
collision_mask = 4
[node name="CollisionShape2D" type="CollisionShape2D" parent="GroundCompanion"]
shape = SubResource("CircleShape2D_1a1t3")
position = Vector2(0, -10)
shape = SubResource("RectangleShape2D_01uoa")
debug_color = Color(0, 0.63529414, 0.40784314, 0.41960785)
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
unique_name_in_owner = true
position = Vector2(0, 5.75)
shape = SubResource("RectangleShape2D_qnulu")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture_filter = 1
position = Vector2(0, 3.9999998)
scale = Vector2(0.1, 0.1)
texture = ExtResource("6_01uoa")
position = Vector2(0, 40)
shape = SubResource("RectangleShape2D_ciuu3")
[node name="LimboStateDebugger" type="Node2D" parent="." node_paths=PackedStringArray("state_root")]
script = ExtResource("8_clxy3")
@ -163,28 +163,47 @@ unique_name_in_owner = true
script = ExtResource("2_11vl8")
dash_speed = 400.0
end_dash_speed = 190.0
climb_hop_velocity_x = 180.0
climb_hop_velocity_y = 334.0
jump_force = 460.0
climb_max_speed_upward = 450.0
climb_max_speed_downward = 800.0
climb_acceleration = 3000.0
climb_hop_velocity_x = 1400.0
climb_hop_velocity_y = 2600.0
climb_jump_velocity_x = 1800.0
climb_jump_velocity_y = 3300.0
custom_move_force = 10000.0
custom_move_max_speed = 4500.0
custom_move_stop_distance = 40.0
jump_force = 5800.0
jump_hold_maxium_time = 0.125
jump_horizontal_Boost = 160.0
jump_countinus_horizontal_Boost = 500.0
jump_horizontal_Boost = 5600.0
jump_countinus_horizontal_Boost = 4000.0
jump_horizontal_Boost_last_time = 0.12
light_gravity_threshold = 135.0
max_jump_horizontal_boost_speed = 3600.0
light_gravity_threshold = 1200.0
light_gravity_mult = 0.6
wall_jump_base_force_x = 260.0
wall_jump_base_force_y = 220.0
fall_maxium_speed = 430.0
air_control_mult = 0.35
run_accel = 1300.0
run_reduce = 2400.0
move_speed_max = 202.0
wall_slide_fall_maxium_speed = 5000.0
wall_jump_base_force_x = 2800.0
wall_jump_base_force_y = 1600.0
fall_maxium_speed = 8000.0
air_control_mult = 0.55
run_accel = 15000.0
run_reduce = 20000.0
move_speed_max = 2650.0
[node name="WallDetector" parent="LocomotionComponent" instance=ExtResource("20_air0b")]
unique_name_in_owner = true
[node name="UpRayCast2D" parent="LocomotionComponent/WallDetector" index="0"]
position = Vector2(0, -141)
target_position = Vector2(155, 0)
[node name="MidRayCast2D" parent="LocomotionComponent/WallDetector" index="1"]
position = Vector2(0, 3)
position = Vector2(0, 42)
target_position = Vector2(154, 0)
[node name="DownRayCast2D" parent="LocomotionComponent/WallDetector" index="2"]
position = Vector2(0, 151)
target_position = Vector2(155, 0)
[node name="SpawnHookComponet" type="Node" parent="."]
script = ExtResource("21_p14kj")
@ -209,8 +228,7 @@ collision_layer = 0
collision_mask = 8
[node name="CollisionShape2D" type="CollisionShape2D" parent="HitBox"]
position = Vector2(0, 5)
shape = SubResource("RectangleShape2D_ogl63")
shape = SubResource("CapsuleShape2D_ciuu3")
debug_color = Color(0.95815283, 0, 0.5313341, 0.41960785)
[node name="RemotePositionSetting" type="Node2D" parent="."]

View File

@ -67,11 +67,11 @@ func _draw() -> void:
var a_x: float = clampf(abs(velocity.x),1,2000) * .3 * sign(locomotion_comp._current_acceleration.x)
var a_y: float = clampf(abs(velocity.x),1,2000) * .3 * sign(locomotion_comp._current_acceleration.y)
draw_line(Vector2.ZERO,Vector2(x, 0),Color.RED,4)
draw_line(Vector2.ZERO,Vector2(0, y),Color.GREEN,4)
draw_line(Vector2.ZERO,Vector2(x, 0),Color.RED,40)
draw_line(Vector2.ZERO,Vector2(0, y),Color.GREEN,40)
draw_line(Vector2.ZERO,Vector2(a_x, 0),Color.YELLOW,2)
draw_line(Vector2.ZERO,Vector2(0, a_y),Color.PURPLE,2)
draw_line(Vector2.ZERO,Vector2(a_x, 0),Color.YELLOW,20)
draw_line(Vector2.ZERO,Vector2(0, a_y),Color.PURPLE,20)
func _process(delta: float) -> void:
queue_redraw()

File diff suppressed because one or more lines are too long

View File

@ -1,8 +1,129 @@
[gd_resource type="TileSet" load_steps=5 format=3 uid="uid://cup1q1upvp18h"]
[gd_resource type="TileSet" load_steps=9 format=3 uid="uid://cup1q1upvp18h"]
[ext_resource type="Texture2D" uid="uid://dnrvktjrinxon" path="res://_asset/tile/pure_color_tile.png" id="1_u6jqb"]
[ext_resource type="Texture2D" uid="uid://dd622t4mw5vva" path="res://_asset/ksw/basicTile01.png" id="2_mucy5"]
[ext_resource type="Texture2D" uid="uid://dufe0liirugbw" path="res://_asset/ksw/basicTile02.png" id="3_u6jqb"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_h7jxu"]
texture = ExtResource("1_u6jqb")
texture_region_size = Vector2i(128, 128)
1:1/0 = 0
2:1/0 = 0
3:1/0 = 0
4:1/0 = 0
5:1/0 = 0
6:1/0 = 0
7:1/0 = 0
8:1/0 = 0
9:1/0 = 0
10:1/0 = 0
12:1/0 = 0
13:1/0 = 0
16:1/0 = 0
17:1/0 = 0
18:1/0 = 0
1:2/0 = 0
2:2/0 = 0
3:2/0 = 0
4:2/0 = 0
5:2/0 = 0
6:2/0 = 0
7:2/0 = 0
8:2/0 = 0
9:2/0 = 0
10:2/0 = 0
16:2/0 = 0
17:2/0 = 0
18:2/0 = 0
1:3/0 = 0
2:3/0 = 0
4:3/0 = 0
5:3/0 = 0
6:3/0 = 0
7:3/0 = 0
8:3/0 = 0
9:3/0 = 0
10:3/0 = 0
1:4/0 = 0
2:4/0 = 0
3:4/0 = 0
4:4/0 = 0
5:4/0 = 0
6:4/0 = 0
7:4/0 = 0
8:4/0 = 0
9:4/0 = 0
10:4/0 = 0
12:4/0 = 0
13:4/0 = 0
1:5/0 = 0
2:5/0 = 0
3:5/0 = 0
4:5/0 = 0
5:5/0 = 0
6:5/0 = 0
7:5/0 = 0
8:5/0 = 0
9:5/0 = 0
10:5/0 = 0
12:5/0 = 0
13:5/0 = 0
12:6/0 = 0
13:6/0 = 0
12:7/0 = 0
13:7/0 = 0
6:9/0 = 0
7:9/0 = 0
8:9/0 = 0
9:9/0 = 0
10:9/0 = 0
11:9/0 = 0
12:9/0 = 0
13:9/0 = 0
6:10/0 = 0
7:10/0 = 0
8:10/0 = 0
9:10/0 = 0
10:10/0 = 0
11:10/0 = 0
12:10/0 = 0
13:10/0 = 0
6:11/0 = 0
7:11/0 = 0
9:11/0 = 0
10:11/0 = 0
12:11/0 = 0
13:11/0 = 0
8:12/0 = 0
9:12/0 = 0
10:12/0 = 0
11:12/0 = 0
6:13/0 = 0
7:13/0 = 0
8:13/0 = 0
9:13/0 = 0
10:13/0 = 0
11:13/0 = 0
12:13/0 = 0
13:13/0 = 0
6:14/0 = 0
7:14/0 = 0
8:14/0 = 0
9:14/0 = 0
10:14/0 = 0
11:14/0 = 0
12:14/0 = 0
13:14/0 = 0
6:15/0 = 0
7:15/0 = 0
8:15/0 = 0
9:15/0 = 0
10:15/0 = 0
11:15/0 = 0
12:15/0 = 0
13:15/0 = 0
11:1/0 = 0
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_u6jqb"]
texture = ExtResource("2_mucy5")
texture_region_size = Vector2i(96, 96)
@ -72,7 +193,180 @@ texture_region_size = Vector2i(96, 96)
10:9/0 = 0
11:9/0 = 0
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_evanm"]
texture = ExtResource("1_u6jqb")
texture_region_size = Vector2i(128, 128)
1:1/0 = 0
1:2/0 = 0
1:3/0 = 0
2:1/0 = 0
3:1/0 = 0
3:2/0 = 0
3:3/0 = 0
2:3/0 = 0
5:1/0 = 0
5:2/0 = 0
5:3/0 = 0
6:1/0 = 0
6:2/0 = 0
6:3/0 = 0
7:1/0 = 0
7:2/0 = 0
7:3/0 = 0
9:1/0 = 0
9:3/0 = 0
9:4/0 = 0
11:1/0 = 0
12:1/0 = 0
13:1/0 = 0
9:5/0 = 0
6:7/0 = 0
5:7/0 = 0
5:8/0 = 0
7:8/0 = 0
7:9/0 = 0
6:9/0 = 0
8:9/0 = 0
7:10/0 = 0
5:10/0 = 0
5:11/0 = 0
6:11/0 = 0
8:11/0 = 0
9:11/0 = 0
9:10/0 = 0
9:8/0 = 0
9:7/0 = 0
8:7/0 = 0
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_nsnhs"]
texture = ExtResource("1_u6jqb")
texture_region_size = Vector2i(96, 96)
1:1/0 = 0
2:1/0 = 0
3:1/0 = 0
4:1/0 = 0
5:1/0 = 0
6:1/0 = 0
7:1/0 = 0
8:1/0 = 0
9:1/0 = 0
10:1/0 = 0
12:1/0 = 0
13:1/0 = 0
14:1/0 = 0
15:1/0 = 0
16:1/0 = 0
17:1/0 = 0
18:1/0 = 0
1:2/0 = 0
2:2/0 = 0
3:2/0 = 0
4:2/0 = 0
5:2/0 = 0
6:2/0 = 0
7:2/0 = 0
8:2/0 = 0
9:2/0 = 0
10:2/0 = 0
12:2/0 = 0
13:2/0 = 0
14:2/0 = 0
15:2/0 = 0
16:2/0 = 0
17:2/0 = 0
18:2/0 = 0
1:3/0 = 0
2:3/0 = 0
4:3/0 = 0
5:3/0 = 0
6:3/0 = 0
7:3/0 = 0
8:3/0 = 0
9:3/0 = 0
10:3/0 = 0
1:4/0 = 0
2:4/0 = 0
3:4/0 = 0
4:4/0 = 0
5:4/0 = 0
6:4/0 = 0
7:4/0 = 0
8:4/0 = 0
9:4/0 = 0
10:4/0 = 0
12:4/0 = 0
13:4/0 = 0
1:5/0 = 0
2:5/0 = 0
3:5/0 = 0
4:5/0 = 0
5:5/0 = 0
6:5/0 = 0
7:5/0 = 0
8:5/0 = 0
9:5/0 = 0
10:5/0 = 0
12:5/0 = 0
13:5/0 = 0
12:6/0 = 0
13:6/0 = 0
12:7/0 = 0
13:7/0 = 0
6:9/0 = 0
7:9/0 = 0
8:9/0 = 0
9:9/0 = 0
10:9/0 = 0
11:9/0 = 0
12:9/0 = 0
13:9/0 = 0
6:10/0 = 0
7:10/0 = 0
8:10/0 = 0
9:10/0 = 0
10:10/0 = 0
11:10/0 = 0
12:10/0 = 0
13:10/0 = 0
6:11/0 = 0
7:11/0 = 0
9:11/0 = 0
10:11/0 = 0
12:11/0 = 0
13:11/0 = 0
8:12/0 = 0
9:12/0 = 0
10:12/0 = 0
11:12/0 = 0
6:13/0 = 0
7:13/0 = 0
8:13/0 = 0
9:13/0 = 0
10:13/0 = 0
11:13/0 = 0
12:13/0 = 0
13:13/0 = 0
6:14/0 = 0
7:14/0 = 0
8:14/0 = 0
9:14/0 = 0
10:14/0 = 0
11:14/0 = 0
12:14/0 = 0
13:14/0 = 0
6:15/0 = 0
7:15/0 = 0
8:15/0 = 0
9:15/0 = 0
10:15/0 = 0
11:15/0 = 0
12:15/0 = 0
13:15/0 = 0
[resource]
tile_size = Vector2i(96, 96)
sources/1 = SubResource("TileSetAtlasSource_u6jqb")
sources/2 = SubResource("TileSetAtlasSource_wtljp")
sources/0 = SubResource("TileSetAtlasSource_h7jxu")
sources/3 = SubResource("TileSetAtlasSource_evanm")
sources/4 = SubResource("TileSetAtlasSource_nsnhs")

245
_tileset/pure_tile_set.tres Normal file
View File

@ -0,0 +1,245 @@
[gd_resource type="TileSet" load_steps=5 format=3 uid="uid://bt25n4i5s2bkj"]
[ext_resource type="Texture2D" uid="uid://ntm66vo10u2q" path="res://_asset/ksw/tile/tile.png" id="1_jwfln"]
[ext_resource type="Texture2D" uid="uid://cchtbbig85jcm" path="res://_asset/ksw/tile/tile02.png" id="2_5i20m"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_i03by"]
texture = ExtResource("1_jwfln")
texture_region_size = Vector2i(128, 128)
1:1/0 = 0
1:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, -48, 64, -48, 64, 48, 48, 48, 48, 64, -48, 64)
2:1/0 = 0
2:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-64, -48, 64, -48, 64, 48, -64, 48)
3:1/0 = 0
3:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-64, -48, 48, -48, 48, 64, -48, 64, -48, 48, -64, 48)
3:2/0 = 0
3:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, -64, 48, -64, 48, 64, -48, 64)
3:3/0 = 0
3:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, -64, 48, -64, 48, 48, -64, 48, -64, -48, -48, -48)
2:3/0 = 0
2:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(64, -48, 64, 48, -64, 48, -64, -48)
1:3/0 = 0
1:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(64, -48, 64, 48, -48, 48, -48, -64, 48, -64, 48, -48)
1:2/0 = 0
1:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, 64, -48, -64, 48, -64, 48, 64)
6:1/0 = 0
6:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-64, -48, 64, -48, 64, 64, -64, 64)
5:2/0 = 0
5:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, -64, 64, -64, 64, 64, -48, 64)
5:1/0 = 0
5:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, -48, 64, -48, 64, 64, -48, 64)
6:2/0 = 0
6:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-64, -64, 64, -64, 64, 64, -64, 64)
6:3/0 = 0
6:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-64, -64, 64, -64, 64, 48, -64, 48)
5:3/0 = 0
5:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, -64, 64, -64, 64, 48, -48, 48)
7:3/0 = 0
7:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-64, -64, 48, -64, 48, 48, -64, 48)
7:2/0 = 0
7:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-64, -64, 48, -64, 48, 64, -64, 64)
7:1/0 = 0
7:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-64, -48, 48, -48, 48, 64, -64, 64)
9:1/0 = 0
9:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, -48, 48, -48, 48, 48, -48, 48)
11:1/0 = 0
11:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, -48, 64, -48, 64, 48, -48, 48)
12:1/0 = 0
12:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-64, -48, 64, -48, 64, 48, -64, 48)
13:1/0 = 0
13:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-64, -48, 48, -48, 48, 48, -64, 48)
9:3/0 = 0
9:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, 64, -48, -48, 48, -48, 48, 64)
9:4/0 = 0
9:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, 64, -48, -64, 48, -64, 48, 64)
9:5/0 = 0
9:5/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, 48, -48, -64, 48, -64, 48, 48)
1:4/0 = 0
1:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, 48, -48, -48, 64, -48, 64, 48)
2:4/0 = 0
2:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, 48, -64, 48, -64, -48, 64, -48, 64, 48, 48, 48, 48, 64, -48, 64)
3:4/0 = 0
3:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-64, 48, -64, -48, 48, -48, 48, 48)
2:5/0 = 0
2:5/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, 48, -48, -64, 48, -64, 48, 48)
2:6/0 = 0
2:6/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, 64, -48, -48, 48, -48, 48, 64)
2:7/0 = 0
2:7/0/physics_layer_0/polygon_0/points = PackedVector2Array(-64, 48, -64, -48, -48, -48, -48, -64, 48, -64, 48, -48, 64, -48, 64, 48)
1:7/0 = 0
1:7/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, 48, -48, -48, 64, -48, 64, 48)
3:7/0 = 0
3:7/0/physics_layer_0/polygon_0/points = PackedVector2Array(-64, 48, -64, -48, 48, -48, 48, 48)
1:8/0 = 0
1:8/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, 64, -48, -48, 48, -48, 48, 64)
1:9/0 = 0
1:9/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, 64, -48, -64, 48, -64, 48, -48, 64, -48, 64, 48, 48, 48, 48, 64)
1:10/0 = 0
1:10/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, 48, -48, -64, 48, -64, 48, 48)
2:9/0 = 0
2:9/0/physics_layer_0/polygon_0/points = PackedVector2Array(-64, 48, -64, -48, 48, -48, 48, 48)
3:9/0 = 0
3:9/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, 48, -48, -48, 64, -48, 64, 48)
4:8/0 = 0
4:8/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, 64, -48, -48, 48, -48, 48, 64)
4:9/0 = 0
4:9/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, 64, -48, 48, -64, 48, -64, -48, -48, -48, -48, -64, 48, -64, 48, 64)
4:10/0 = 0
4:10/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, 48, -48, -64, 48, -64, 48, 48)
5:8/0 = 0
5:8/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, 48, -48, -64, 48, -64, 48, 48)
5:7/0 = 0
5:7/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, 64, -48, -48, 64, -48, 64, 48, 48, 48, 48, 64)
6:7/0 = 0
6:7/0/physics_layer_0/polygon_0/points = PackedVector2Array(-64, 48, -64, -48, 48, -48, 48, 48)
8:7/0 = 0
8:7/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, 48, -48, -48, 64, -48, 64, 48)
9:7/0 = 0
9:7/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, 48, -64, 48, -64, -48, 48, -48, 48, 64, -48, 64)
9:8/0 = 0
9:8/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, -64, 48, -64, 48, 48, -48, 48)
7:8/0 = 0
7:8/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, -48, 48, -48, 48, 64, -48, 64)
7:9/0 = 0
7:9/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, -48, -48, -64, 48, -64, 48, -48, 64, -48, 64, 48, 47.33333, 48, 48, 64, -48, 64, -48, 48, -64, 48, -64, -48)
6:9/0 = 0
6:9/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, -48, 64, -48, 64, 48, -48, 48)
8:9/0 = 0
8:9/0/physics_layer_0/polygon_0/points = PackedVector2Array(48, -48, 47.33333, 48, -64, 48, -64, -48)
7:10/0 = 0
7:10/0/physics_layer_0/polygon_0/points = PackedVector2Array(48, -64, 47.33333, 48, -48, 48, -48, -64)
5:10/0 = 0
5:10/0/physics_layer_0/polygon_0/points = PackedVector2Array(48, -48, 48, 64, -48, 64, -48, -48)
6:11/0 = 0
6:11/0/physics_layer_0/polygon_0/points = PackedVector2Array(48, 48, -64, 48, -64, -48, 48, -48)
8:11/0 = 0
8:11/0/physics_layer_0/polygon_0/points = PackedVector2Array(64, 48, -48, 48, -48, -48, 64, -48)
5:11/0 = 0
5:11/0/physics_layer_0/polygon_0/points = PackedVector2Array(48, -48, 64, -48, 64, 48, -48, 48, -48, -64, 48, -64)
9:11/0 = 0
9:11/0/physics_layer_0/polygon_0/points = PackedVector2Array(48, 48, -64, 48, -64, -48, -48, -48, -48, -64, 48, -64)
9:10/0 = 0
9:10/0/physics_layer_0/polygon_0/points = PackedVector2Array(48, 64, -48, 64, -48, -48, 48, -48)
11:9/0 = 0
11:9/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, 64, -48, -64, 64, -64, 64, 64)
11:8/0 = 0
11:8/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, 64, -48, -48, 64, -48, 64, 64)
11:10/0 = 0
11:10/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, 48, -48, -64, 64, -64, 64, 48)
12:9/0 = 0
12:9/0/physics_layer_0/polygon_0/points = PackedVector2Array(-64, 64, -64, -64, 64, -64, 64, 64)
12:8/0 = 0
12:8/0/physics_layer_0/polygon_0/points = PackedVector2Array(-64, 64, -64, -48, -48, -48, -48, -64, 64, -64, 64, 64)
12:7/0 = 0
12:7/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, 64, -48, -48, 64, -48, 64, 64)
13:7/0 = 0
13:7/0/physics_layer_0/polygon_0/points = PackedVector2Array(-64, 64, -64, -48, 64, -48, 64, 64)
14:7/0 = 0
14:7/0/physics_layer_0/polygon_0/points = PackedVector2Array(-64, 64, -64, -48, 48, -48, 48, 64)
13:8/0 = 0
13:8/0/physics_layer_0/polygon_0/points = PackedVector2Array(-64, 64, -64, -64, 64, -64, 64, 64)
13:9/0 = 0
13:9/0/physics_layer_0/polygon_0/points = PackedVector2Array(-64, 64, -64, -64, 64, -64, 64, 64)
13:10/0 = 0
13:10/0/physics_layer_0/polygon_0/points = PackedVector2Array(-64, 64, -64, -64, 64, -64, 64, 64)
13:11/0 = 0
13:11/0/physics_layer_0/polygon_0/points = PackedVector2Array(-64, -64, 64, -64, 64, 48, -64, 48)
12:10/0 = 0
12:10/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, 48, -64, 48, -64, -64, 64, -64, 64, 64, -48, 64)
12:11/0 = 0
12:11/0/physics_layer_0/polygon_0/points = PackedVector2Array(-48, 48, -48, -64, 64, -64, 64, 48)
14:8/0 = 0
14:8/0/physics_layer_0/polygon_0/points = PackedVector2Array(-64, 64, -64, -64, 48, -64, 48, -48, 64, -48, 64, 64)
14:9/0 = 0
14:9/0/physics_layer_0/polygon_0/points = PackedVector2Array(-64, 64, -64, -64, 64, -64, 64, 64)
14:10/0 = 0
14:10/0/physics_layer_0/polygon_0/points = PackedVector2Array(-64, -64, 64, -64, 64, 48, 48, 48, 48, 64, -64, 64)
14:11/0 = 0
14:11/0/physics_layer_0/polygon_0/points = PackedVector2Array(-64, -64, 48, -64, 48, 48, -64, 48)
15:9/0 = 0
15:9/0/physics_layer_0/polygon_0/points = PackedVector2Array(-64, 64, -64, -64, 48, -64, 48, 64)
15:10/0 = 0
15:10/0/physics_layer_0/polygon_0/points = PackedVector2Array(-64, -64, 48, -64, 48, 48, -64, 48)
15:8/0 = 0
15:8/0/physics_layer_0/polygon_0/points = PackedVector2Array(-64, 64, -64, -48, 48, -48, 48, 64)
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_ekrk0"]
texture = ExtResource("2_5i20m")
texture_region_size = Vector2i(128, 128)
1:1/0 = 0
2:1/0 = 0
3:1/0 = 0
4:1/0 = 0
2:2/0 = 0
3:2/0 = 0
2:3/0 = 0
3:3/0 = 0
3:4/0 = 0
3:5/0 = 0
3:6/0 = 0
3:7/0 = 0
3:8/0 = 0
2:8/0 = 0
2:7/0 = 0
2:6/0 = 0
2:5/0 = 0
2:4/0 = 0
1:4/0 = 0
4:4/0 = 0
1:7/0 = 0
4:7/0 = 0
5:7/0 = 0
6:7/0 = 0
7:7/0 = 0
8:7/0 = 0
6:6/0 = 0
7:6/0 = 0
7:8/0 = 0
6:8/0 = 0
6:0/0 = 0
6:1/0 = 0
6:2/0 = 0
6:3/0 = 0
7:2/0 = 0
8:2/0 = 0
9:2/0 = 0
9:3/0 = 0
8:1/0 = 0
9:0/0 = 0
9:1/0 = 0
7:1/0 = 0
11:1/0 = 0
12:1/0 = 0
12:2/0 = 0
11:2/0 = 0
10:2/0 = 0
13:2/0 = 0
11:3/0 = 0
10:4/0 = 0
11:4/0 = 0
12:4/0 = 0
10:5/0 = 0
11:5/0 = 0
12:5/0 = 0
12:6/0 = 0
11:6/0 = 0
10:6/0 = 0
11:7/0 = 0
13:4/0 = 0
14:4/0 = 0
15:4/0 = 0
15:5/0 = 0
15:6/0 = 0
14:6/0 = 0
13:6/0 = 0
13:5/0 = 0
14:5/0 = 0
14:3/0 = 0
14:7/0 = 0
[resource]
tile_size = Vector2i(128, 128)
physics_layer_0/collision_layer = 4
physics_layer_0/collision_mask = 0
sources/3 = SubResource("TileSetAtlasSource_ekrk0")
sources/2 = SubResource("TileSetAtlasSource_i03by")

View File

@ -1,17 +1,30 @@
[gd_scene load_steps=3 format=3 uid="uid://ddwoxlqluxiq5"]
[gd_scene load_steps=4 format=3 uid="uid://ddwoxlqluxiq5"]
[ext_resource type="Script" uid="uid://bvxgviq7l64ck" path="res://addons/reedcomponent/grap_hook/garpping_hook_v_2.gd" id="1_jrg4x"]
[sub_resource type="CircleShape2D" id="CircleShape2D_2bmkq"]
[sub_resource type="CircleShape2D" id="CircleShape2D_jrg4x"]
radius = 5.0990195
[node name="GarppingHookV2" type="Node2D"]
script = ExtResource("1_jrg4x")
min_length = 900.0
max_length = 1200.0
stretching_speed = 5000.0
max_speed = 5600.0
retract_speed = 7000.0
[node name="Line2D" type="Line2D" parent="."]
unique_name_in_owner = true
points = PackedVector2Array(0, 0, 80, 0)
width = 8.0
width = 50.0
[node name="ShapeCast2D" type="ShapeCast2D" parent="."]
unique_name_in_owner = true
shape = SubResource("CircleShape2D_2bmkq")
target_position = Vector2(80, 0)
collision_mask = 20
[node name="RayCast2D" type="RayCast2D" parent="."]
unique_name_in_owner = true

View File

@ -1,20 +1,27 @@
class_name Hook
extends Node2D
@onready var line_2d: Line2D = %Line2D
@onready var shape_cast_2d: ShapeCast2D = %ShapeCast2D
@onready var tip_detector: Area2D = $TipDetector
## ================
## Export Field
## ================
##钩爪最短长度
@export var min_length := 140.0
##钩爪最大长度
@export var max_length := 200.0
##钩爪伸出速度
@export var stretching_speed: float = 1400.0
## 最大速度上限
@export var max_speed: float = 800.0
@export_category("Hook Retract")
@export var retract_speed: float = 1800.0
@onready var line_2d: Line2D = %Line2D
@onready var ray: RayCast2D = %RayCast2D
@onready var tip_detector: Area2D = $TipDetector
## 钩爪当前速度
var _current_velocity: Vector2 = Vector2.ZERO
var _tween: Tween
const GRAPABLE_GROUP = &"GRAPABLE"
@ -40,8 +47,8 @@ var _dir_id: int = -1
# =================
func _ready() -> void:
ray.enabled = true
ray.target_position = Vector2.ZERO
shape_cast_2d.enabled = true
shape_cast_2d.target_position = Vector2.ZERO
## 初始化
func init(hook_comp: SpawnHookComponet, reset_to_target: bool) -> void:
@ -100,10 +107,6 @@ func _process(_delta: float) -> void:
# Core Logic
# =================
## 钩爪当前速度
var _current_velocity: Vector2 = Vector2.ZERO
## 最大速度上限
@export var max_speed: float = 800.0
func _update_stretching(delta: float) -> void:
# 检测前端点的吸引力 (direction, strength)
@ -134,17 +137,17 @@ func _update_stretching(delta: float) -> void:
tip_detector.global_position = predicted_pos
# RayCast 也应该射到“累计长度”
ray.target_position = velocity_dir * next_length
ray.force_raycast_update()
# ShapeCast2D 也应该射到"累计长度"
shape_cast_2d.target_position = velocity_dir * next_length
shape_cast_2d.force_shapecast_update()
# ===== 命中檢測(最高優先)=====
if ray.is_colliding():
var collider := ray.get_collider()
if shape_cast_2d.is_colliding():
var collider := shape_cast_2d.get_collider(0)
if collider is Node2D and collider.is_in_group(GRAPABLE_GROUP):
var hit_pos := ray.get_collision_point()
var hit_pos := shape_cast_2d.get_collision_point(0)
_current_length = global_position.distance_to(hit_pos)
ray.target_position = velocity_dir * _current_length
shape_cast_2d.target_position = velocity_dir * _current_length
_handle_hit(collider as Node2D, hit_pos)
return
@ -190,7 +193,7 @@ func _handle_hit(target: Node2D, hit_pos: Vector2) -> void:
_stretching_dir = Vector2.ZERO
_current_velocity = Vector2.ZERO # 重置速度
ray.target_position = to_local(hit_pos)
shape_cast_2d.target_position = to_local(hit_pos)
# 如果 target 有 on_hook_hit 方法,调用它(传入钩爪实例)
if target.has_method(&"on_hook_hit"):
@ -218,8 +221,8 @@ func _release_hook() -> void:
_anchor.queue_free()
_anchor = null
# 3. 重置 Ray 與 Line視覺清乾淨
ray.target_position = Vector2.ZERO
# 3. 重置 ShapeCast2D 與 Line視覺清乾淨
shape_cast_2d.target_position = Vector2.ZERO
_update_line()
func release_hook_with_transition(has_trans: bool) -> void:
@ -242,7 +245,7 @@ func release_hook_with_transition(has_trans: bool) -> void:
_anchor = null
# 当前末端位置(本地坐标)
var start_pos: Vector2 = ray.target_position
var start_pos: Vector2 = shape_cast_2d.target_position
var distance := start_pos.length()
if distance <= 0.001:
@ -260,7 +263,7 @@ func release_hook_with_transition(has_trans: bool) -> void:
_tween.set_ease(Tween.EASE_IN)
_tween.tween_property(
ray,
shape_cast_2d,
"target_position",
Vector2.ZERO,
duration
@ -273,9 +276,9 @@ func release_hook_with_transition(has_trans: bool) -> void:
func _update_line() -> void:
if _anchor and is_instance_valid(_anchor):
# 关键:锚点是世界坐标固定的,把它换算到 Hook 的本地坐标
ray.target_position = to_local(_anchor.global_position)
shape_cast_2d.target_position = to_local(_anchor.global_position)
line_2d.set_point_position(1, ray.target_position)
line_2d.set_point_position(1, shape_cast_2d.target_position)
func _create_anchor_on_node(target: Node2D, hit_global_pos: Vector2) -> Node2D:
if _anchor and is_instance_valid(_anchor):

View File

@ -29,12 +29,14 @@ class_name LocomotionComponent extends ComponentBase
##空中控制乘量,在空中移动时修改
@export var air_control_mult : float = .65
#基础的乘量对所有Character相同
const GRAVITY_BASIC_MULT_FACTOR : float = 1.8
const GRAVITY_BASIC_MULT_FACTOR : float = 18
#下坠速度和最大下坠速度的阈值,超过了这个阈值会开启下坠速度修正,主要取决于设备的刷新率固写死。
const FALL_SPEED_EXCEED_TOLERANCE_THRESHOLD = 40
@export_category("Locomotion Properties")
@export_subgroup("Move")
##如果为true则使用加速度逐渐达到目标速度如果为false则直接设置速度
@export var use_acceleration: bool = true
##存在輸入時,向最大移動輸入運動的加速度
@export var run_accel : float = 1200
##不存在輸入時向Vector.ZERO運動的加速度
@ -125,11 +127,15 @@ func _update_movement(delta : float) -> void:
var applyed_air_control = 1 if characterbody.is_on_floor() else air_control_mult
var target_move_speed = move_speed_max * input_dir
characterbody.velocity.x = speed_approach(
characterbody.velocity.x,
target_move_speed,
applyed_air_control * accel * delta
)
if use_acceleration:
characterbody.velocity.x = speed_approach(
characterbody.velocity.x,
target_move_speed,
applyed_air_control * accel * delta
)
else:
# 直接设置速度,无加速度
characterbody.velocity.x = target_move_speed
#检测是否这帧开始了移动
_check_is_start_move()

View File

@ -11,7 +11,7 @@ config_version=5
[application]
config/name="godot-plateformer"
run/main_scene="uid://3vc8ojbiyy5w"
run/main_scene="uid://x041oerqe1iu"
config/features=PackedStringArray("4.5", "Forward Plus")
config/icon="res://icon.svg"
@ -24,10 +24,8 @@ ReedCameraSystem="*res://addons/reedcamera/scripts/ReedCameraGlobal.gd"
[display]
window/size/viewport_width=640
window/size/viewport_height=360
window/size/window_width_override=1920
window/size/window_height_override=1080
window/size/viewport_width=1920
window/size/viewport_height=1080
window/stretch/mode="canvas_items"
[editor_plugins]