关卡迭代

master
chendian 1 year ago
parent 5e54b9dc18
commit f03080c0a8

@ -12,6 +12,8 @@ is_floating = true
is_hit_down = false
is_rebound = false
is_stop_self = true
is_throw_check = false
is_throw_end = false
hit_back_speed = 3.0
hit_up_speed = 3.0
hit_back_duration = 0.05

@ -12,6 +12,8 @@ is_floating = false
is_hit_down = true
is_rebound = false
is_stop_self = true
is_throw_check = false
is_throw_end = false
hit_back_speed = 6.0
hit_up_speed = -6.0
hit_back_duration = 0.05

@ -12,6 +12,8 @@ is_floating = true
is_hit_down = false
is_rebound = true
is_stop_self = true
is_throw_check = false
is_throw_end = false
hit_back_speed = 0.0
hit_up_speed = 3.0
hit_back_duration = 0.0

@ -12,6 +12,8 @@ is_floating = false
is_hit_down = false
is_rebound = false
is_stop_self = true
is_throw_check = false
is_throw_end = false
hit_back_speed = 0.0
hit_up_speed = 0.5
hit_back_duration = 0.0

@ -12,6 +12,8 @@ is_floating = false
is_hit_down = true
is_rebound = false
is_stop_self = true
is_throw_check = false
is_throw_end = false
hit_back_speed = 6.0
hit_up_speed = -6.0
hit_back_duration = 0.05

@ -12,6 +12,8 @@ is_floating = false
is_hit_down = false
is_rebound = false
is_stop_self = true
is_throw_check = false
is_throw_end = false
hit_back_speed = 2.0
hit_up_speed = 1.0
hit_back_duration = 0.05

@ -12,6 +12,8 @@ is_floating = false
is_hit_down = false
is_rebound = false
is_stop_self = true
is_throw_check = false
is_throw_end = false
hit_back_speed = 4.0
hit_up_speed = 2.0
hit_back_duration = 0.05

@ -12,6 +12,8 @@ is_floating = true
is_hit_down = false
is_rebound = false
is_stop_self = true
is_throw_check = false
is_throw_end = false
hit_back_speed = 2.0
hit_up_speed = 2.0
hit_back_duration = 0.05

@ -12,6 +12,8 @@ is_floating = true
is_hit_down = true
is_rebound = false
is_stop_self = true
is_throw_check = false
is_throw_end = false
hit_back_speed = 6.0
hit_up_speed = -6.0
hit_back_duration = 0.05

@ -12,6 +12,8 @@ is_floating = true
is_hit_down = false
is_rebound = false
is_stop_self = true
is_throw_check = false
is_throw_end = false
hit_back_speed = 0.0
hit_up_speed = 3.0
hit_back_duration = 0.0

@ -22,3 +22,4 @@ hp_max = 100.0
attack = 10.0
attack1 = ExtResource("1_4vq22")
attack1_box = ExtResource("2_ewiqr")
sub_character_auto_create = false

@ -20,3 +20,4 @@ stun = ExtResource("6_25uqm")
mp = ExtResource("2_pl54c")
hp_max = 20.0
attack = 10.0
sub_character_auto_create = false

@ -20,3 +20,4 @@ stun = ExtResource("6_vlmkd")
mp = ExtResource("2_gly3h")
hp_max = 50.0
attack = 10.0
sub_character_auto_create = false

@ -20,3 +20,4 @@ stun = ExtResource("6_ar00t")
mp = ExtResource("2_kkpsf")
hp_max = 100.0
attack = 10.0
sub_character_auto_create = false

@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="CoreCfg" load_steps=3 format=3 uid="uid://c5h02ni8psoxq"]
[gd_resource type="Resource" script_class="CoreCfg" load_steps=2 format=3 uid="uid://c5h02ni8psoxq"]
[ext_resource type="Script" path="res://script/config/core_cfg.gd" id="1_rsjym"]

@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="CoreCfg" load_steps=4 format=3 uid="uid://djwu1qw3irbmj"]
[gd_resource type="Resource" script_class="CoreCfg" load_steps=2 format=3 uid="uid://djwu1qw3irbmj"]
[ext_resource type="Script" path="res://script/config/core_cfg.gd" id="2_glcvn"]

@ -14,6 +14,8 @@ ignore_push = false
stance_from = 100
stance_to = 2
break_level = 3
is_charging = false
mp_cost = 0
refresh_animation = false
sprite_frames = ExtResource("3_ppacp")
animation_name = "long_attack01"

@ -14,6 +14,8 @@ ignore_push = false
stance_from = 100
stance_to = 3
break_level = 1
is_charging = false
mp_cost = 0
refresh_animation = false
sprite_frames = ExtResource("3_11afq")
animation_name = "long_attack02"

@ -14,6 +14,8 @@ ignore_push = false
stance_from = 100
stance_to = 4
break_level = 1
is_charging = false
mp_cost = 0
refresh_animation = false
sprite_frames = ExtResource("3_2hchk")
animation_name = "long_attack03"

@ -16,6 +16,8 @@ sub_character = ExtResource("4_bu37n")
stance_from = 102
stance_to = 0
break_level = 3
is_charging = false
mp_cost = 0
refresh_animation = false
sprite_frames = ExtResource("3_w10pb")
animation_name = "long_attack01"

@ -14,6 +14,8 @@ ignore_push = false
stance_from = 100
stance_to = 4
break_level = 3
is_charging = false
mp_cost = 0
refresh_animation = false
sprite_frames = ExtResource("3_roc1y")
animation_name = "long_attack04"

@ -21,6 +21,8 @@ attack1_box = ExtResource("2_2gnst")
stance_from = 12
stance_to = 13
break_level = 3
is_charging = false
mp_cost = 0
refresh_animation = false
sprite_frames = ExtResource("5_pslv2")
animation_name = "fist_air_attack03"

@ -21,6 +21,8 @@ attack1_box = ExtResource("2_wc71d")
stance_from = 1
stance_to = 2
break_level = 3
is_charging = false
mp_cost = 0
refresh_animation = false
sprite_frames = ExtResource("4_fevaa")
animation_name = "fist_attack02"

@ -21,6 +21,8 @@ attack1_box = ExtResource("2_1sc65")
stance_from = 99
stance_to = 3
break_level = 3
is_charging = false
mp_cost = 0
refresh_animation = false
sprite_frames = ExtResource("5_kkp4n")
animation_name = ""

@ -21,5 +21,8 @@ attack1_box = ExtResource("2_nk4i8")
stance_from = 10
stance_to = 11
break_level = 3
is_charging = false
mp_cost = 0
refresh_animation = false
sprite_frames = ExtResource("4_q0bln")
animation_name = ""

@ -21,6 +21,8 @@ attack1_box = ExtResource("2_xxivk")
stance_from = 11
stance_to = 12
break_level = 3
is_charging = false
mp_cost = 0
refresh_animation = false
sprite_frames = ExtResource("4_ahm2t")
animation_name = "long_air_attack02"

@ -21,6 +21,8 @@ attack1_box = ExtResource("2_t6vds")
stance_from = 11
stance_to = 12
break_level = 3
is_charging = false
mp_cost = 0
refresh_animation = false
sprite_frames = ExtResource("5_ciknn")
animation_name = "long_air_skill01"

@ -21,6 +21,8 @@ attack1_box = ExtResource("2_whygf")
stance_from = 12
stance_to = 0
break_level = 3
is_charging = false
mp_cost = 0
refresh_animation = false
sprite_frames = ExtResource("5_6p3pi")
animation_name = "long_air_skill02"

@ -21,6 +21,8 @@ attack1_box = ExtResource("2_my38a")
stance_from = 0
stance_to = 1
break_level = 3
is_charging = false
mp_cost = 0
refresh_animation = false
sprite_frames = ExtResource("5_xel5p")
animation_name = "long_attack01"

@ -21,6 +21,8 @@ attack1_box = ExtResource("2_s06n4")
stance_from = 1
stance_to = 2
break_level = 3
is_charging = false
mp_cost = 0
refresh_animation = false
sprite_frames = ExtResource("3_jidy7")
animation_name = "long_attack02"

@ -23,6 +23,8 @@ attack2_box = ExtResource("2_j0l20")
stance_from = 2
stance_to = 3
break_level = 3
is_charging = false
mp_cost = 0
refresh_animation = false
sprite_frames = ExtResource("3_sr2og")
animation_name = "long_attack03"

@ -21,6 +21,8 @@ attack1_box = ExtResource("2_tsg38")
stance_from = 2
stance_to = 10
break_level = 3
is_charging = false
mp_cost = 0
refresh_animation = false
sprite_frames = ExtResource("4_rbnly")
animation_name = "long_skill02"

@ -19,6 +19,8 @@ attack1 = ExtResource("1_4lnv2")
stance_from = 0
stance_to = 1
break_level = 3
is_charging = false
mp_cost = 0
refresh_animation = false
sprite_frames = ExtResource("5_8vcrr")
animation_name = "short_attack01"

@ -19,6 +19,8 @@ attack1 = ExtResource("1_hnewa")
stance_from = 1
stance_to = 2
break_level = 3
is_charging = false
mp_cost = 0
refresh_animation = false
sprite_frames = ExtResource("5_dxfya")
animation_name = "short_attack02"

@ -20,6 +20,8 @@ attack2 = ExtResource("1_afi2j")
stance_from = 2
stance_to = 3
break_level = 3
is_charging = false
mp_cost = 0
refresh_animation = false
sprite_frames = ExtResource("5_40215")
animation_name = "short_attack03"

@ -19,6 +19,8 @@ attack1 = ExtResource("1_d23lh")
stance_from = 3
stance_to = 4
break_level = 3
is_charging = false
mp_cost = 0
refresh_animation = false
sprite_frames = ExtResource("5_owk7o")
animation_name = "short_attack04"

@ -0,0 +1,18 @@
[remap]
importer="MagicaVoxel.With.Extensions.To.Mesh"
type="Mesh"
uid="uid://chotbnjdrbcx0"
path="res://.godot/imported/g_f_graybox.vox-1d65b5810b991a142705bfe126cea196.mesh"
[deps]
source_file="res://resource/mesh_level/g_f_graybox.vox"
dest_files=["res://.godot/imported/g_f_graybox.vox-1d65b5810b991a142705bfe126cea196.mesh"]
[params]
Scale=0.02
GreedyMeshGenerator=true
SnapToGround=false
FirstKeyframeOnly=true

@ -1,18 +0,0 @@
[remap]
importer="MagicaVoxel.With.Extensions.To.Mesh"
type="Mesh"
uid="uid://7isbaeh4qvrd"
path="res://.godot/imported/g_graybox.vox-c179cd599b4ed4ce2da42ad202312279.mesh"
[deps]
source_file="res://resource/mesh_level/g_graybox.vox"
dest_files=["res://.godot/imported/g_graybox.vox-c179cd599b4ed4ce2da42ad202312279.mesh"]
[params]
Scale=0.02
GreedyMeshGenerator=true
SnapToGround=false
FirstKeyframeOnly=true

@ -1,18 +0,0 @@
[remap]
importer="MagicaVoxel.With.Extensions.To.Mesh"
type="Mesh"
uid="uid://bo2mjsuhk8vm6"
path="res://.godot/imported/g_graybox_stair1.vox-fcf4e2f6c2563273435711a4c8f95d27.mesh"
[deps]
source_file="res://resource/mesh_level/g_graybox_stair1.vox"
dest_files=["res://.godot/imported/g_graybox_stair1.vox-fcf4e2f6c2563273435711a4c8f95d27.mesh"]
[params]
Scale=0.02
GreedyMeshGenerator=true
SnapToGround=false
FirstKeyframeOnly=true

@ -1,18 +0,0 @@
[remap]
importer="MagicaVoxel.With.Extensions.To.Mesh"
type="Mesh"
uid="uid://qv72doxyfjtu"
path="res://.godot/imported/g_graybox_stair2.vox-078d123c1adf6b0a2ecea868e78b2320.mesh"
[deps]
source_file="res://resource/mesh_level/g_graybox_stair2.vox"
dest_files=["res://.godot/imported/g_graybox_stair2.vox-078d123c1adf6b0a2ecea868e78b2320.mesh"]
[params]
Scale=0.02
GreedyMeshGenerator=true
SnapToGround=false
FirstKeyframeOnly=true

@ -0,0 +1,18 @@
[remap]
importer="MagicaVoxel.With.Extensions.To.Mesh"
type="Mesh"
uid="uid://bfv08lqmqgwdr"
path="res://.godot/imported/g_s1_graybox_stair1.vox-c8f011c54d71da5a8afff9520e466ae0.mesh"
[deps]
source_file="res://resource/mesh_level/g_s1_graybox_stair1.vox"
dest_files=["res://.godot/imported/g_s1_graybox_stair1.vox-c8f011c54d71da5a8afff9520e466ae0.mesh"]
[params]
Scale=0.02
GreedyMeshGenerator=true
SnapToGround=false
FirstKeyframeOnly=true

@ -0,0 +1,18 @@
[remap]
importer="MagicaVoxel.With.Extensions.To.Mesh"
type="Mesh"
uid="uid://dqkrgm0h1kud8"
path="res://.godot/imported/g_s2_graybox_stair2.vox-b69b3fd31d0406eb9936c3d0411483a1.mesh"
[deps]
source_file="res://resource/mesh_level/g_s2_graybox_stair2.vox"
dest_files=["res://.godot/imported/g_s2_graybox_stair2.vox-b69b3fd31d0406eb9936c3d0411483a1.mesh"]
[params]
Scale=0.02
GreedyMeshGenerator=true
SnapToGround=false
FirstKeyframeOnly=true

@ -1,4 +0,0 @@
[gd_resource type="ConcavePolygonShape3D" format=3 uid="uid://bdcs11jue0b7a"]
[resource]
data = PackedVector3Array(-0.32, 0.32, -0.32, 0.32, 0.32, -0.32, 0.32, 0.32, 0.32, 0.32, 0.32, 0.32, -0.32, 0.32, 0.32, -0.32, 0.32, -0.32, 0.32, -0.32, 0.32, 0.32, -0.32, -0.32, -0.32, -0.32, -0.32, -0.32, -0.32, -0.32, -0.32, -0.32, 0.32, 0.32, -0.32, 0.32, -0.32, 0.32, -0.32, -0.32, 0.32, 0.32, -0.32, -0.32, 0.32, -0.32, -0.32, 0.32, -0.32, -0.32, -0.32, -0.32, 0.32, -0.32, 0.32, 0.32, -0.32, 0.32, -0.32, -0.32, 0.32, -0.32, 0.32, 0.32, -0.32, 0.32, 0.32, 0.32, 0.32, 0.32, 0.32, -0.32, -0.32, -0.32, 0.32, -0.32, 0.32, 0.32, 0.32, 0.32, 0.32, 0.32, 0.32, 0.32, 0.32, -0.32, 0.32, -0.32, -0.32, 0.32, 0.32, 0.32, -0.32, -0.32, 0.32, -0.32, -0.32, -0.32, -0.32, -0.32, -0.32, -0.32, 0.32, -0.32, -0.32, 0.32, 0.32, -0.32)

@ -1,4 +0,0 @@
[gd_resource type="ConcavePolygonShape3D" format=3 uid="uid://b8mk8bhmwvw46"]
[resource]
data = PackedVector3Array(-0.32, 0, -0.32, 0.32, 0, -0.32, 0.32, 0, 0.32, 0.32, 0, 0.32, -0.32, 0, 0.32, -0.32, 0, -0.32, 0.32, -0.32, 0.32, 0.32, -0.32, -0.32, -0.32, -0.32, -0.32, -0.32, -0.32, -0.32, -0.32, -0.32, 0.32, 0.32, -0.32, 0.32, -0.32, 0, -0.32, -0.32, 0, 0.32, -0.32, -0.32, 0.32, -0.32, -0.32, 0.32, -0.32, -0.32, -0.32, -0.32, 0, -0.32, 0.32, 0, -0.32, 0.32, -0.32, -0.32, 0.32, -0.32, 0.32, 0.32, -0.32, 0.32, 0.32, 0, 0.32, 0.32, 0, -0.32, -0.32, -0.32, 0.32, -0.32, 0, 0.32, 0.32, 0, 0.32, 0.32, 0, 0.32, 0.32, -0.32, 0.32, -0.32, -0.32, 0.32, 0.32, 0, -0.32, -0.32, 0, -0.32, -0.32, -0.32, -0.32, -0.32, -0.32, -0.32, 0.32, -0.32, -0.32, 0.32, 0, -0.32)

@ -0,0 +1,4 @@
[gd_resource type="ConvexPolygonShape3D" format=3 uid="uid://ch7a55vopmlvc"]
[resource]
points = PackedVector3Array(-0.64, -0.64, -0.64, -0.64, -0.64, 0.64, 0.64, -0.64, -0.64, 0.64, -0.64, 0.64, -0.64, 0.64, -0.64, -0.64, 0.64, 0.64, 0.64, 0.64, -0.64, 0.64, 0.64, 0.64)

@ -0,0 +1,4 @@
[gd_resource type="ConvexPolygonShape3D" format=3 uid="uid://b5rsjse7squ4k"]
[resource]
points = PackedVector3Array(-0.64, -0.64, -0.64, -0.64, -0.64, 0.64, 0.64, -0.64, -0.64, 0.64, -0.64, 0.64, -0.64, 0, -0.64, -0.64, 0, 0.64, 0.64, 0, -0.64, 0.64, 0, 0.64)

@ -0,0 +1,4 @@
[gd_resource type="ConvexPolygonShape3D" format=3 uid="uid://bu7jdmo4po5n7"]
[resource]
points = PackedVector3Array(-0.64, -0.64, -0.64, -0.64, -0.64, 0.64, 0.64, -0.64, -0.64, 0.64, -0.64, 0.64, 0.64, 0, -0.64, 0.64, 0, 0.64)

@ -0,0 +1,4 @@
[gd_resource type="ConvexPolygonShape3D" format=3 uid="uid://dmvwq5xbans5b"]
[resource]
points = PackedVector3Array(-0.64, -0.64, -0.64, -0.64, -0.64, 0.64, 0.64, -0.64, -0.64, 0.64, -0.64, 0.64, -0.64, 0, -0.64, -0.64, 0, 0.64, 0.64, 0.64, -0.64, 0.64, 0.64, 0.64)

@ -0,0 +1,4 @@
[gd_resource type="ConvexPolygonShape3D" format=3 uid="uid://oiuc1i17weh2"]
[resource]
points = PackedVector3Array(-0.32, -0.32, -0.32, -0.32, -0.32, 0.32, 0.32, -0.32, -0.32, 0.32, -0.32, 0.32, -0.32, 0.32, -0.32, -0.32, 0.32, 0.32, 0.32, 0.32, -0.32, 0.32, 0.32, 0.32)

@ -0,0 +1,4 @@
[gd_resource type="ConvexPolygonShape3D" format=3 uid="uid://brunktj1e5jec"]
[resource]
points = PackedVector3Array(-0.32, -0.32, -0.32, -0.32, -0.32, 0.32, 0.32, -0.32, -0.32, 0.32, -0.32, 0.32, -0.32, 0, -0.32, -0.32, 0, 0.32, 0.32, 0, -0.32, 0.32, 0, 0.32)

@ -0,0 +1,4 @@
[gd_resource type="ConvexPolygonShape3D" format=3 uid="uid://bqqhwchli2vq6"]
[resource]
points = PackedVector3Array(-0.32, -0.32, -0.32, -0.32, -0.32, 0.32, 0.32, -0.32, -0.32, 0.32, -0.32, 0.32, 0.32, 0, -0.32, 0.32, 0, 0.32)

@ -0,0 +1,4 @@
[gd_resource type="ConvexPolygonShape3D" format=3 uid="uid://diy2wgxtccjvg"]
[resource]
points = PackedVector3Array(-0.32, -0.32, -0.32, -0.32, -0.32, 0.32, 0.32, -0.32, -0.32, 0.32, -0.32, 0.32, -0.32, 0, -0.32, -0.32, 0, 0.32, 0.32, 0.32, -0.32, 0.32, 0.32, 0.32)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -17,7 +17,7 @@
[ext_resource type="SpriteFrames" uid="uid://2cb8lknel0ih" path="res://resource/animation/character/basic_move.aseprite" id="15_70jx1"]
[ext_resource type="Script" path="res://script/character/throw.gd" id="16_ot265"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_mmrro"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_l0gkv"]
height = 1.0
[sub_resource type="Curve" id="Curve_v7nnw"]
@ -75,11 +75,14 @@ point_count = 2
[node name="Character" type="CharacterBody3D"]
collision_layer = 2
slide_on_ceiling = false
floor_stop_on_slope = false
floor_block_on_wall = false
script = ExtResource("1_tonbs")
[node name="Collision" type="CollisionShape3D" parent="."]
unique_name_in_owner = true
shape = SubResource("CylinderShape3D_mmrro")
shape = SubResource("CapsuleShape3D_l0gkv")
[node name="Pushbox" type="Area3D" parent="."]
unique_name_in_owner = true

File diff suppressed because one or more lines are too long

@ -76,19 +76,28 @@ func refresh_animation_lib():
func refresh_mesh_library(path_list: Array, with_clear: bool = false):
print("refresh_mesh_library")
var default_shape_full: Array[Variant] = [load("res://resource/mesh_library/default_shape_full.tres") as Shape3D, Transform3D.IDENTITY]
var default_shape_half: Array[Variant] = [load("res://resource/mesh_library/default_shape_half.tres") as Shape3D, Transform3D.IDENTITY]
var mesh_library_level: MeshLibrary = load("res://resource/mesh_library/mesh_library_level.tres") as MeshLibrary
var mesh_library_ground: MeshLibrary = load("res://resource/mesh_library/mesh_library_ground.tres") as MeshLibrary
var mesh_library_level_id_list: Array[int] = []
var mesh_library_ground_id_list: Array[int] = []
var default_shape_normal_full: Array[Variant] = [load("res://resource/mesh_library/default_shape_normal_full.tres") as Shape3D, Transform3D.IDENTITY]
var default_shape_normal_half: Array[Variant] = [load("res://resource/mesh_library/default_shape_normal_half.tres") as Shape3D, Transform3D.IDENTITY]
var default_shape_normal_stair1: Array[Variant] = [load("res://resource/mesh_library/default_shape_normal_stair1.tres") as Shape3D, Transform3D.IDENTITY]
var default_shape_normal_stair2: Array[Variant] = [load("res://resource/mesh_library/default_shape_normal_stair2.tres") as Shape3D, Transform3D.IDENTITY]
var default_shape_large_full: Array[Variant] = [load("res://resource/mesh_library/default_shape_large_full.tres") as Shape3D, Transform3D.IDENTITY]
var default_shape_large_half: Array[Variant] = [load("res://resource/mesh_library/default_shape_large_half.tres") as Shape3D, Transform3D.IDENTITY]
var default_shape_large_stair1: Array[Variant] = [load("res://resource/mesh_library/default_shape_large_stair1.tres") as Shape3D, Transform3D.IDENTITY]
var default_shape_large_stair2: Array[Variant] = [load("res://resource/mesh_library/default_shape_large_stair2.tres") as Shape3D, Transform3D.IDENTITY]
var mesh_library_level: MeshLibrary = load("res://resource/mesh_library/mesh_library_level.tres") as MeshLibrary
var mesh_library_ground: MeshLibrary = load("res://resource/mesh_library/mesh_library_ground.tres") as MeshLibrary
var mesh_library_level_id_list: Array[int] = []
var mesh_library_ground_id_list: Array[int] = []
for file_name_full in path_list:
var mesh_name = file_name_full.get_file().split('-')[0].trim_suffix('.vox')
print(mesh_name)
var is_ground = mesh_name.begins_with("g_")
if is_ground:
mesh_name = mesh_name.trim_prefix("g_")
var mesh: Mesh = load(file_name_full) as Mesh
var mesh_library: MeshLibrary = mesh_library_ground if mesh_name.begins_with("g_") else mesh_library_level
var mesh_library_id_list: Array[int] = mesh_library_ground_id_list if mesh_name.begins_with("g_") else mesh_library_level_id_list
var mesh_library: MeshLibrary = mesh_library_ground if is_ground else mesh_library_level
var mesh_library_id_list: Array[int] = mesh_library_ground_id_list if is_ground else mesh_library_level_id_list
var mesh_id: int = mesh_library.find_item_by_name(mesh_name)
if mesh_id == -1:
mesh_id = mesh_library.get_last_unused_item_id()
@ -96,21 +105,22 @@ func refresh_mesh_library(path_list: Array, with_clear: bool = false):
mesh_library_id_list.append(mesh_id)
mesh_library.set_item_name(mesh_id, mesh_name)
mesh_library.set_item_mesh(mesh_id, mesh)
if mesh_name.begins_with("f_"):
#full cube
mesh_library.set_item_shapes(mesh_id, default_shape_full)
elif mesh_name.begins_with("h_"):
#half cube
mesh_library.set_item_shapes(mesh_id, default_shape_half)
else:
#custom shape
var new_shape: Array[Variant] = [mesh.create_convex_shape(), Transform3D.IDENTITY]
mesh_library.set_item_shapes(mesh_id, new_shape)
var name_prefix = mesh_name.split("_")[0] if mesh_name.contains("_") else mesh_name
var item_shapes: Array
match name_prefix:
"f": item_shapes = default_shape_normal_full if not is_ground else default_shape_large_full
"h": item_shapes = default_shape_normal_half if not is_ground else default_shape_large_half
"s1": item_shapes = default_shape_normal_stair1 if not is_ground else default_shape_large_stair1
"s2": item_shapes = default_shape_normal_stair2 if not is_ground else default_shape_large_stair2
_: item_shapes = [mesh.create_convex_shape(), Transform3D.IDENTITY]
if item_shapes:
mesh_library.set_item_shapes(mesh_id, item_shapes)
_save_mesh_library(mesh_library_level, mesh_library_level_id_list, with_clear)
_save_mesh_library(mesh_library_ground, mesh_library_ground_id_list, with_clear)
func _save_mesh_library( mesh_library: MeshLibrary, id_list: Array, with_clear: bool):
func _save_mesh_library(mesh_library: MeshLibrary, id_list: Array, with_clear: bool):
if with_clear:
var ids: PackedInt32Array = mesh_library.get_item_list()
for id in ids:

@ -48,7 +48,12 @@ func set_body_scale(cfg: CharacterCfg) -> void:
var half_height: float = height / 2
var center_height: float = Setting.pixel_size * 26
collision.position = Vector3(0, half_height, 0)
collision.scale = body_scale
var shape: Shape3D = collision.shape
if shape is CapsuleShape3D:
shape.radius = width
shape.height = height
else:
collision.scale = body_scale
pushbox.position = Vector3(0, half_height, 0)
pushbox.scale = body_scale
status.basic_offset = Vector3(0, center_height, randf()*0.001)
@ -64,26 +69,6 @@ func set_material(material: ShaderMaterial, material_sub: ShaderMaterial):
view.material_override.next_pass = material_sub
func is_on_stair()->bool:
if velocity.x > 0:
if raycast_stair(Vector3.RIGHT): return true
elif velocity.x < 0:
if raycast_stair(Vector3.LEFT): return true
if velocity.z > 0:
if raycast_stair(Vector3.BACK): return true
elif velocity.z < 0:
if raycast_stair(Vector3.FORWARD): return true
return false
func raycast_stair(dir: Vector3)->bool:
var width: float = Setting.pixel_size * status.cfg.sprite_width
var from: Vector3 = position + (Vector3.UP * Setting.pixel_size * 6) + (dir * width * 0.4)
var to: Vector3 = from + dir * width * 0.2
var up: Vector3 = to + Vector3.UP * Setting.pixel_size * 4
return Util.raycast_wall(from, to) and Util.raycast_wall(up, to)
#==getter==
func id()->int: return status.id

@ -43,15 +43,11 @@ func update_speed_y(delta) -> void:
character.velocity.y = 0
return
var has_y_speed: bool = (status.skill_float_speed != 0) or (status.hit_up_speed != 0)
var is_on_stair: bool = character.is_on_stair()
if has_y_speed:
character.velocity.y = status.skill_float_speed + status.hit_up_speed
else:
if is_on_stair:
character.velocity.y = status.cfg.move.speed * 0.75
else:
if not status.is_on_floor:
character.velocity.y -= gravity * delta * status.cfg.move.gravity_scale
if not status.is_on_floor:
character.velocity.y -= gravity * delta * status.cfg.move.gravity_scale
status.speed_y = character.velocity.y

@ -2,12 +2,13 @@ extends Node3D
class_name Level
var level_instance_list: Array[LevelInstance]
var born_pos: Vector3
func GetLevelInstanceList() -> Array[LevelInstance]:
func get_level_instance_list() -> Array[LevelInstance]:
if not level_instance_list:
level_instance_list = []
var rooms_node: Node = %Levels as Node
var rooms_node: Node3D = %Levels as Node3D
for rooms_node_child in rooms_node.get_children():
if not rooms_node_child is LevelArea:
continue
@ -16,3 +17,10 @@ func GetLevelInstanceList() -> Array[LevelInstance]:
rooms_node_child_child.level_area_cfg = rooms_node_child.cfg
level_instance_list.append(rooms_node_child_child)
return level_instance_list
func get_born_pos() -> Vector3:
if not born_pos:
var born_pos_node: Node3D = %BornPos as Node3D
born_pos = born_pos_node.get_global_position()
return born_pos

@ -39,7 +39,6 @@ func _ready():
SignalManager.character_create.connect(on_character_create)
SignalManager.character_pos_changed.connect(on_character_pos_changed)
SignalManager.character_destroy.connect(on_character_destroy)
SignalManager.character_hit_floor.connect(on_character_hit_floor)
SignalManager.level_size_change.connect(on_level_size_change)
SignalManager.level_pos_change.connect(on_level_pos_change)
SignalManager.level_loading_end.connect(on_level_loading_end)
@ -98,7 +97,6 @@ func on_character_create(id: int, type: int, pos: Vector3):
if type == Enum.ECharacterType.Player:
target = id
on_character_pos_changed(id, pos)
on_character_hit_floor(id, pos)
on_level_loading_end()
@ -106,19 +104,14 @@ func on_character_pos_changed(id: int, pos: Vector3):
if id == target:
target_character_pos.x = pos.x
target_character_pos.y = pos.z
target_pos_y = pos.y
refresh_target_pos()
grid_block_material.set_shader_parameter("target_position", pos)
func on_character_destroy(id: int): target = 0
func on_character_hit_floor(id: int, pos: Vector3):
if id == target:
target_pos_y = pos.y
refresh_target_pos()
grid_block_material.set_shader_parameter("target_position", pos)
func refresh_target_pos():
var pos: Vector2 = target_character_pos
var camera_size_diff: float = (camera_size - size)/2.0

@ -2,7 +2,8 @@ extends Node3D
func _ready():
Global.level_mgr.init()
Global.character_mgr.create_character(ResourceManager.cfg_character_player, Enum.ETeam.Player, Vector3(5, 1, 2))
Global.character_mgr.create_character(ResourceManager.cfg_character_player, Enum.ETeam.Player, Global.level_mgr.get_born_pos())
func _process(delta):
pass

@ -18,9 +18,13 @@ func init():
var level_scene: PackedScene = load("res://scene/level/level.tscn")
level = level_scene.instantiate() as Level
add_child(level)
var level_instance_list: Array[LevelInstance] = level.GetLevelInstanceList()
var level_instance_list: Array[LevelInstance] = level.get_level_instance_list()
for level_instance in level_instance_list:
for level_id in get_level_id_list(level_instance.get_global_position(), level_instance.size):
var level_id_list: Array[Vector3i] = get_level_id_list(level_instance.get_global_position(), level_instance.size)
# print("xx", level_instance.name, ":", level_id_list)
for level_id in level_id_list:
if level_id in level_instance_dict:
print("关卡id重复", level_id)
level_instance_dict[level_id] = level_instance
@ -28,6 +32,10 @@ func _process(delta) -> void:
pass
func get_born_pos() -> Vector3:
return level.get_born_pos()
func on_character_create(id: int, type: int, pos: Vector3):
if type == Enum.ECharacterType.Player:
target = id
@ -70,13 +78,18 @@ func get_level_id_list(pos: Vector3, size: Vector3i) -> Array[Vector3i]:
func get_level_id(pos: Vector3) -> Vector3i:
var ret: Vector3i = Vector3i(get_div_scale(pos.x, Setting.size_basic.x), get_div_scale(pos.y, Setting.size_basic.y), get_div_scale(pos.z, Setting.size_basic.z))
# print("get_level_id", pos, ret)
return ret
func get_div_scale(a: float, b: float) -> int:
#解决浮点数精度问题
var div: float = a / b
var decimal: float = abs(div - int(div))
if decimal > 0.999:
div = int(div) + sign(div)
var div: float = a / b
var is_positive: bool = div > 0
var decimal: float = abs(div - int(div))
if is_positive and decimal > 0.999:
div += 0.001
if not is_positive and decimal < 0.001:
div += 0.001
# print("get_div_scale", " ", a, " ", b, " ", decimal, " ", div)
return floor(div)

Loading…
Cancel
Save