diff --git a/addons/nklbdev.aseprite_importers/editor_import_plugins/_animation_importer_base.gd b/addons/nklbdev.aseprite_importers/editor_import_plugins/_animation_importer_base.gd index b084baf..302c3fa 100644 --- a/addons/nklbdev.aseprite_importers/editor_import_plugins/_animation_importer_base.gd +++ b/addons/nklbdev.aseprite_importers/editor_import_plugins/_animation_importer_base.gd @@ -158,7 +158,7 @@ func _export_texture(source_file: String, options: Common.ParsedAnimationOptions image.save_png(global_png_path) image = null - if is_png_file_present: + if false: # This is for reload the image if it was changed by import processing _parent_plugin.get_editor_interface().get_resource_filesystem().call_deferred("scan_sources") else: diff --git a/addons/nklbdev.aseprite_importers/icon.png.import b/addons/nklbdev.aseprite_importers/icon.png.import index ba87fb6..2dee341 100644 --- a/addons/nklbdev.aseprite_importers/icon.png.import +++ b/addons/nklbdev.aseprite_importers/icon.png.import @@ -3,25 +3,26 @@ importer="texture" type="CompressedTexture2D" uid="uid://bbww6j66bavar" -path="res://.godot/imported/icon.png-fcba8a3700fb5af89c995132142de0f4.ctex" +path.s3tc="res://.godot/imported/icon.png-fcba8a3700fb5af89c995132142de0f4.s3tc.ctex" metadata={ -"vram_texture": false +"imported_formats": ["s3tc_bptc"], +"vram_texture": true } [deps] source_file="res://addons/nklbdev.aseprite_importers/icon.png" -dest_files=["res://.godot/imported/icon.png-fcba8a3700fb5af89c995132142de0f4.ctex"] +dest_files=["res://.godot/imported/icon.png-fcba8a3700fb5af89c995132142de0f4.s3tc.ctex"] [params] -compress/mode=0 +compress/mode=2 compress/high_quality=false compress/lossy_quality=0.7 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 -mipmaps/generate=false +mipmaps/generate=true mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" @@ -31,4 +32,4 @@ 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 +detect_3d/compress_to=0 diff --git a/icon.svg.import b/icon.svg.import index 7e51f66..cf4d789 100644 --- a/icon.svg.import +++ b/icon.svg.import @@ -3,25 +3,26 @@ importer="texture" type="CompressedTexture2D" uid="uid://c0jks8qogcdhp" -path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" +path.s3tc="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.s3tc.ctex" metadata={ -"vram_texture": false +"imported_formats": ["s3tc_bptc"], +"vram_texture": true } [deps] source_file="res://icon.svg" -dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"] +dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.s3tc.ctex"] [params] -compress/mode=0 +compress/mode=2 compress/high_quality=false compress/lossy_quality=0.7 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 -mipmaps/generate=false +mipmaps/generate=true mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" @@ -31,7 +32,7 @@ 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 +detect_3d/compress_to=0 svg/scale=1.0 editor/scale_with_editor_scale=false editor/convert_colors_with_editor_theme=false diff --git a/resource/animation/character/basic_move.png.import b/resource/animation/character/basic_move.png.import index 8a37f1e..823a007 100644 --- a/resource/animation/character/basic_move.png.import +++ b/resource/animation/character/basic_move.png.import @@ -2,7 +2,7 @@ importer="texture" type="CompressedTexture2D" -uid="uid://efo5fl408b5y" +uid="uid://dg3ucl4idggd4" path="res://.godot/imported/basic_move.png-ca2a3b7e7fd156603c8676a90db56136.ctex" metadata={ "vram_texture": false @@ -18,14 +18,14 @@ dest_files=["res://.godot/imported/basic_move.png-ca2a3b7e7fd156603c8676a90db561 compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 -compress/hdr_compression=0 -compress/normal_map=2 +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/fix_alpha_border=false +process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false process/hdr_as_srgb=false diff --git a/resource/animation/character/hero01_long_attack.png.import b/resource/animation/character/hero01_long_attack.png.import index 636b1db..0852b2e 100644 --- a/resource/animation/character/hero01_long_attack.png.import +++ b/resource/animation/character/hero01_long_attack.png.import @@ -23,7 +23,7 @@ compress/normal_map=2 compress/channel_pack=0 mipmaps/generate=false mipmaps/limit=-1 -roughness/mode=0 +roughness/mode=1 roughness/src_normal="" process/fix_alpha_border=false process/premult_alpha=false diff --git a/resource/animation/character/hero01_move.png.import b/resource/animation/character/hero01_move.png.import index 6325b7e..6147e4b 100644 --- a/resource/animation/character/hero01_move.png.import +++ b/resource/animation/character/hero01_move.png.import @@ -2,26 +2,27 @@ importer="texture" type="CompressedTexture2D" -uid="uid://y8qxpvedtw6j" -path="res://.godot/imported/hero01_move.png-bcacccbe39aeeae76a6dd3feeffec29f.ctex" +uid="uid://dkcoj30ykgfck" +path.s3tc="res://.godot/imported/hero01_move.png-bcacccbe39aeeae76a6dd3feeffec29f.s3tc.ctex" metadata={ -"vram_texture": false +"imported_formats": ["s3tc_bptc"], +"vram_texture": true } [deps] source_file="res://resource/animation/character/hero01_move.png" -dest_files=["res://.godot/imported/hero01_move.png-bcacccbe39aeeae76a6dd3feeffec29f.ctex"] +dest_files=["res://.godot/imported/hero01_move.png-bcacccbe39aeeae76a6dd3feeffec29f.s3tc.ctex"] [params] -compress/mode=0 +compress/mode=2 compress/high_quality=false compress/lossy_quality=0.7 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 -mipmaps/generate=false +mipmaps/generate=true mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" @@ -31,4 +32,4 @@ 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 +detect_3d/compress_to=0 diff --git a/scene/character/character.tscn b/scene/character/character.tscn index 9a5d643..a70b54d 100644 --- a/scene/character/character.tscn +++ b/scene/character/character.tscn @@ -1,9 +1,11 @@ -[gd_scene load_steps=11 format=3 uid="uid://ksxwg0alt2us"] +[gd_scene load_steps=14 format=3 uid="uid://ksxwg0alt2us"] [ext_resource type="Script" path="res://script/character/character.gd" id="1_tonbs"] [ext_resource type="Script" path="res://script/character/status.gd" id="2_txdip"] +[ext_resource type="Shader" path="res://shader/character.gdshader" id="3_j0vnf"] [ext_resource type="SpriteFrames" uid="uid://ce83cuqwgwwi4" path="res://resource/animation/character/hero01_long_attack.aseprite" id="3_q8i10"] [ext_resource type="Script" path="res://script/character/move.gd" id="4_66r53"] +[ext_resource type="Texture2D" uid="uid://daqn6aqfp1hva" path="res://resource/animation/character/hero01_long_attack.png" id="4_fcd8a"] [ext_resource type="Script" path="res://script/character/view.gd" id="4_vijjv"] [ext_resource type="Script" path="res://script/character/skill.gd" id="6_h4xqy"] [ext_resource type="AnimationLibrary" uid="uid://croik07a1qko5" path="res://resource/skill_animation_library/animation_library.tres" id="6_pakq5"] @@ -12,6 +14,11 @@ [sub_resource type="BoxShape3D" id="BoxShape3D_ty8lx"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_3u7mw"] +render_priority = 0 +shader = ExtResource("3_j0vnf") +shader_parameter/tex = ExtResource("4_fcd8a") + [node name="Character" type="CharacterBody3D"] script = ExtResource("1_tonbs") @@ -23,15 +30,21 @@ shape = SubResource("BoxShape3D_ty8lx") [node name="Status" type="Node3D" parent="."] unique_name_in_owner = true script = ExtResource("2_txdip") -speed_up_rate = -0.5 +speed_up_rate = -1.0 +break_level = 4 [node name="View" type="AnimatedSprite3D" parent="."] unique_name_in_owner = true transform = Transform3D(1, 0, 0, 0, 1.414, 0, 0, 0, 1, 0, 0.376646, 0) +material_override = SubResource("ShaderMaterial_3u7mw") +lod_bias = 0.001 +gi_mode = 0 +double_sided = false alpha_cut = 2 texture_filter = 0 sprite_frames = ExtResource("3_q8i10") -animation = &"long_air_attack03" +animation = &"long_air_attack01" +frame = 8 script = ExtResource("4_vijjv") [node name="Move" type="Node3D" parent="."] diff --git a/script/_global/setting.gd b/script/_global/setting.gd index 8613fdb..d831a37 100644 --- a/script/_global/setting.gd +++ b/script/_global/setting.gd @@ -6,3 +6,7 @@ const sprite_scale : float = 1.414 #技能系统 const input_alive_time : float = 0.5 + +#移动 +const drag_ground : float = 20 +const drag_air : float = 5 diff --git a/script/_global/util.gd b/script/_global/util.gd index 68f9552..49db84a 100644 --- a/script/_global/util.gd +++ b/script/_global/util.gd @@ -5,6 +5,14 @@ extends Node3D func get_resource_name(resource:Resource) -> String: return resource.resource_path.get_file().trim_suffix('.tres') #todo 性能 +func vector_reduce(vector:Vector2,reduce:float) -> Vector2: + var len = vector.length() + if len == 0: + return vector + var new_len = max(len - reduce,0) + var scale_rate = new_len / len + return vector * scale_rate + func refresh_animation_lib(): var animation_library_path = "res://resource/skill_animation_library/animation_library.tres" var animation_library = load(animation_library_path) diff --git a/script/character/move.gd b/script/character/move.gd index 92a25f1..1d89e33 100644 --- a/script/character/move.gd +++ b/script/character/move.gd @@ -11,7 +11,7 @@ func _physics_process(delta): if status.is_pause:return update_on_floor(delta) update_speed_y(delta) - update_move() + update_move(delta) character.move_and_slide() func update_on_floor(delta): @@ -28,11 +28,22 @@ func update_speed_y(delta): character.velocity.y -= gravity * delta * status.cfg.move.gravity_scale status.speed_y = character.velocity.y -func update_move(): +func update_move(delta): var move_velocity = status.move_dir * (status.cfg.move.speed * (1 + status.speed_up_rate)) var skill_velocity = status.skill_dir * status.skill_move_speed var hit_back_velocity = status.hit_back_dir * status.hit_back_speed move_velocity += skill_velocity + hit_back_velocity + + if move_velocity.length() == 0: + move_velocity = Vector2(character.velocity.x,character.velocity.z); + if status.is_on_floor: + move_velocity = Util.vector_reduce(move_velocity,Setting.drag_ground*delta) + else: + move_velocity = Util.vector_reduce(move_velocity,Setting.drag_air*delta) + else: + move_velocity.x = move_velocity.x + move_velocity.y = move_velocity.y + character.velocity.x = move_velocity.x character.velocity.z = move_velocity.y diff --git a/shader/character.gdshader b/shader/character.gdshader new file mode 100644 index 0000000..6fc43fc --- /dev/null +++ b/shader/character.gdshader @@ -0,0 +1,17 @@ +shader_type spatial; +render_mode depth_prepass_alpha,unshaded; + +uniform sampler2D tex : source_color,filter_nearest; + +void fragment() { + vec4 col = texture(tex, UV); + if(col.a<0.5){ + discard; + } + ALBEDO = col.rgb; + ALPHA = 1.0; +} + +void light() { + DIFFUSE_LIGHT = vec3(0, 0, 0); +} \ No newline at end of file