diff --git a/addons/godot-git-plugin/win64/~libgit_plugin.windows.editor.x86_64.dll b/addons/godot-git-plugin/win64/~libgit_plugin.windows.editor.x86_64.dll new file mode 100644 index 0000000..47bbb1d Binary files /dev/null and b/addons/godot-git-plugin/win64/~libgit_plugin.windows.editor.x86_64.dll differ diff --git a/resources/images/bullets/Enchanted_Sword/Enchanted_Beam.png b/resources/images/bullets/Enchanted_Sword/Enchanted_Beam.png new file mode 100644 index 0000000..08abb4e Binary files /dev/null and b/resources/images/bullets/Enchanted_Sword/Enchanted_Beam.png differ diff --git a/resources/images/bullets/Enchanted_Sword/Enchanted_Beam.png.import b/resources/images/bullets/Enchanted_Sword/Enchanted_Beam.png.import new file mode 100644 index 0000000..8cad88f --- /dev/null +++ b/resources/images/bullets/Enchanted_Sword/Enchanted_Beam.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://doavl47vaddfj" +path="res://.godot/imported/Enchanted_Beam.png-77e6b4cc215e0e022de9ea8b0a52747d.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resources/images/bullets/Enchanted_Sword/Enchanted_Beam.png" +dest_files=["res://.godot/imported/Enchanted_Beam.png-77e6b4cc215e0e022de9ea8b0a52747d.ctex"] + +[params] + +compress/mode=0 +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/limit=-1 +roughness/mode=0 +roughness/src_normal="" +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 diff --git a/resources/images/weapons/Enchanted_Sword.png b/resources/images/weapons/Enchanted_Sword.png new file mode 100644 index 0000000..370f4f7 Binary files /dev/null and b/resources/images/weapons/Enchanted_Sword.png differ diff --git a/resources/images/weapons/Enchanted_Sword.png.import b/resources/images/weapons/Enchanted_Sword.png.import new file mode 100644 index 0000000..0672881 --- /dev/null +++ b/resources/images/weapons/Enchanted_Sword.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ckmjjonp8tx4" +path="res://.godot/imported/Enchanted_Sword.png-2ceb888fecf100f517e156722a58f2d0.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resources/images/weapons/Enchanted_Sword.png" +dest_files=["res://.godot/imported/Enchanted_Sword.png-2ceb888fecf100f517e156722a58f2d0.ctex"] + +[params] + +compress/mode=0 +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/limit=-1 +roughness/mode=0 +roughness/src_normal="" +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 diff --git a/scenes/bullets/enchanted_beam.tscn b/scenes/bullets/enchanted_beam.tscn new file mode 100644 index 0000000..7db4a00 --- /dev/null +++ b/scenes/bullets/enchanted_beam.tscn @@ -0,0 +1,29 @@ +[gd_scene load_steps=4 format=3 uid="uid://c6uw0pckwbylu"] + +[ext_resource type="Texture2D" uid="uid://doavl47vaddfj" path="res://resources/images/bullets/Enchanted_Sword/Enchanted_Beam.png" id="1_185ht"] +[ext_resource type="Script" path="res://scripts/bullets/enchanted_beam.gd" id="2_quqb1"] + +[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_fb1sb"] +radius = 8.48529 +height = 70.7107 + +[node name="Enchanted_Beam" type="Area2D"] +position = Vector2(629, 285) +script = ExtResource("2_quqb1") +direction = Vector2(-1, -1.5) +speed = 500.0 +metadata/_edit_group_ = true + +[node name="Out_Screen" type="VisibleOnScreenNotifier2D" parent="."] + +[node name="Start" type="Timer" parent="."] +one_shot = true +autostart = true + +[node name="Sprite2D" type="Sprite2D" parent="."] +scale = Vector2(2, 2) +texture = ExtResource("1_185ht") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +rotation = 0.785398 +shape = SubResource("CapsuleShape2D_fb1sb") diff --git a/scenes/weapons/enchanted_sword.tscn b/scenes/weapons/enchanted_sword.tscn new file mode 100644 index 0000000..6d1fa27 --- /dev/null +++ b/scenes/weapons/enchanted_sword.tscn @@ -0,0 +1,12 @@ +[gd_scene load_steps=3 format=3 uid="uid://dikatje0ca8i5"] + +[ext_resource type="Texture2D" uid="uid://ckmjjonp8tx4" path="res://resources/images/weapons/Enchanted_Sword.png" id="1_cwcxs"] +[ext_resource type="Script" path="res://scripts/weapons/enchanted_sword.gd" id="2_h56vq"] + +[node name="Enchanted_Sword" type="Sprite2D"] +position = Vector2(600, 300) +rotation = -2.2218 +scale = Vector2(2, 2) +texture = ExtResource("1_cwcxs") +script = ExtResource("2_h56vq") +metadata/_edit_group_ = true diff --git a/scripts/bullets/enchanted_beam.gd b/scripts/bullets/enchanted_beam.gd new file mode 100644 index 0000000..e7e633f --- /dev/null +++ b/scripts/bullets/enchanted_beam.gd @@ -0,0 +1,20 @@ +extends Area2D + +@export var direction : Vector2 +@export var speed : float +# Called when the node enters the scene tree for the first time. +func _ready(): + rotation = PI / 4 + Vector2(0, 0).angle_to_point(direction) + direction = direction.normalized() + set_process(0) + $Start.timeout.connect(start) + $Out_Screen.screen_exited.connect(queue_free) + +func start(): + set_process(1) + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + position += delta * speed * direction + + diff --git a/scripts/weapons/enchanted_sword.gd b/scripts/weapons/enchanted_sword.gd new file mode 100644 index 0000000..3215df5 --- /dev/null +++ b/scripts/weapons/enchanted_sword.gd @@ -0,0 +1,74 @@ +extends Sprite2D + + +var finished : bool +func _ready(): + finished = true + swingStart(Vector2(330, 330), Vector2(600, 300)) + + +var now_func : Callable # 当前动作对应函数 + + +func start(func_name : Callable): + if !finished: # 没完成 + return + finished = false + now_func = func_name + +func exit(): + finished = true + +func radToVector(rad : float) -> Vector2: + return Vector2(cos(rad), sin(rad)) +# 剑头指向某一方向的rotation +func swordToRotation(rad : float) -> float: + return rad + PI / 4 + +#返回是否达到指定位置 +# 旋转并移动到指定位置 #剑头的角度 +func normalMove(end_point : Vector2, end_rotation : float , speed : float, delta : float) -> bool: + if (position - end_point).length() <= speed / 100: + return true + # 起点指向终点的向量 + var vector = end_point - position + # 起点到终点转的角度 + var direction = radToVector(rotation).angle_to(radToVector(swordToRotation(end_rotation))) + var rotate_speed = direction / vector.length() * speed + vector = vector.normalized() * speed + + rotation += rotate_speed * delta #旋转 + position += vector * delta# 向指定位置移动 + return false + +# ---swing--- +var start_point : Vector2 +var target : Vector2 +var times : int +func swingStart(point : Vector2, to : Vector2): + start(swing) + start_point = point + target = to + + + +# 在大概start_point这个位置, 向target挥舞攻击 +func swing(delta : float): + if times >= 5: + exit() + return + # 移到(从start_point向(start_point与target连线垂直方向)一定距离) + var even = times % 2 == 0 + var rad = start_point.angle_to_point(target) + var to_position = 200 * radToVector(rad + (- PI / 2 if even else PI / 2)) + var arrive = normalMove(start_point + to_position, rad -PI / 3 if even else PI / 3, 600, delta) + if arrive: + times += 1 + +# ----------- +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + if !finished && now_func: + now_func.call(delta) + # else : + # 应该有个默认状态保持竖直朝下 并上下漂浮?