diff --git a/components/Bullets/Volcano.tscn b/components/Bullets/Volcano.tscn index 0e05dca..c0a3271 100644 --- a/components/Bullets/Volcano.tscn +++ b/components/Bullets/Volcano.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=15 format=3 uid="uid://8uepi7uql314"] +[gd_scene load_steps=13 format=3 uid="uid://8uepi7uql314"] [ext_resource type="PackedScene" uid="uid://crtdkysmnkith" path="res://components/Abstracts/BulletBase.tscn" id="1_gd3m7"] [ext_resource type="Script" uid="uid://ci5hswfhck5as" path="res://scripts/Contents/Bullets/Volcano.gd" id="2_w1utg"] @@ -6,6 +6,7 @@ [ext_resource type="AudioStream" uid="uid://cer3lxbxqw5pq" path="res://resources/sounds/effect/sword1.mp3" id="3_6sp0s"] [ext_resource type="AudioStream" uid="uid://cfwu55dfgs4bl" path="res://resources/sounds/effect/sword2.mp3" id="4_1sgli"] [ext_resource type="AudioStream" uid="uid://bm2o8hu7nyqh1" path="res://resources/sounds/effect/sword3.mp3" id="5_b5nxd"] +[ext_resource type="Script" uid="uid://ckc6guqib3rno" path="res://scripts/Statemachine/FollowPosition.gd" id="7_1sgli"] [sub_resource type="Animation" id="Animation_w1utg"] length = 0.001 @@ -20,88 +21,40 @@ tracks/0/keys = { "points": PackedFloat32Array(150, -0.25, 0, 0.25, 0), "times": PackedFloat32Array(0) } -tracks/1/type = "value" +tracks/1/type = "bezier" tracks/1/imported = false tracks/1/enabled = true -tracks/1/path = NodePath("%hitbox:disabled") +tracks/1/path = NodePath("anchor:rotation") tracks/1/interp = 1 tracks/1/loop_wrap = true tracks/1/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 1, -"values": [false] +"handle_modes": PackedInt32Array(0), +"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0) } tracks/2/type = "bezier" tracks/2/imported = false tracks/2/enabled = true -tracks/2/path = NodePath("anchor:rotation") +tracks/2/path = NodePath("anchor:scale:x") tracks/2/interp = 1 tracks/2/loop_wrap = true tracks/2/keys = { "handle_modes": PackedInt32Array(0), -"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0), +"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0), "times": PackedFloat32Array(0) } tracks/3/type = "value" tracks/3/imported = false tracks/3/enabled = true -tracks/3/path = NodePath("%texture/../hitbox2:disabled") +tracks/3/path = NodePath("%texture/..:usingDamageMultiplier") tracks/3/interp = 1 tracks/3/loop_wrap = true tracks/3/keys = { "times": PackedFloat32Array(0), "transitions": PackedFloat32Array(1), "update": 1, -"values": [true] -} -tracks/4/type = "value" -tracks/4/imported = false -tracks/4/enabled = true -tracks/4/path = NodePath("%texture/../hitbox3:disabled") -tracks/4/interp = 1 -tracks/4/loop_wrap = true -tracks/4/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 1, -"values": [true] -} -tracks/5/type = "bezier" -tracks/5/imported = false -tracks/5/enabled = true -tracks/5/path = NodePath("anchor:scale:x") -tracks/5/interp = 1 -tracks/5/loop_wrap = true -tracks/5/keys = { -"handle_modes": PackedInt32Array(0), -"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0), -"times": PackedFloat32Array(0) -} -tracks/6/type = "value" -tracks/6/imported = false -tracks/6/enabled = true -tracks/6/path = NodePath("%texture/..:usingDamageMultiplier") -tracks/6/interp = 1 -tracks/6/loop_wrap = true -tracks/6/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 1, "values": [0] } -tracks/7/type = "value" -tracks/7/imported = false -tracks/7/enabled = true -tracks/7/path = NodePath("%texture/../hitbox4:disabled") -tracks/7/interp = 1 -tracks/7/loop_wrap = true -tracks/7/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 1, -"values": [true] -} [sub_resource type="Animation" id="Animation_oinqg"] resource_name = "destroy" @@ -123,83 +76,47 @@ tracks/0/keys = { "points": PackedFloat32Array(150, -0.25, 0, 0.25, 0, 500, -0.083333336, -8.333334, 0, 0, 300, -0.01666667, 83.333336, 0, 0), "times": PackedFloat32Array(0, 0.2, 0.3) } -tracks/1/type = "value" +tracks/1/type = "bezier" tracks/1/imported = false tracks/1/enabled = true -tracks/1/path = NodePath("%hitbox:disabled") +tracks/1/path = NodePath("anchor:rotation") tracks/1/interp = 1 tracks/1/loop_wrap = true tracks/1/keys = { -"times": PackedFloat32Array(0, 0.4), -"transitions": PackedFloat32Array(1, 1), -"update": 1, -"values": [false, true] -} -tracks/2/type = "bezier" -tracks/2/imported = false -tracks/2/enabled = true -tracks/2/path = NodePath("anchor:rotation") -tracks/2/interp = 1 -tracks/2/loop_wrap = true -tracks/2/keys = { "handle_modes": PackedInt32Array(0, 0, 0, 0, 0, 0), "points": PackedFloat32Array(0, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0, 0.7853982, -0.06585455, -0.14365458, 0.2, 0, -0.7853982, -0.06666666, 0.2617994, 0, 0, -0.7853982, -0.033333343, 0, 0, 0, 3.142, -0.041666668, 0.91629785, 0, 0), "times": PackedFloat32Array(0, 0.3, 0.6, 0.888264, 1.2, 1.45) } -tracks/3/type = "value" -tracks/3/imported = false -tracks/3/enabled = true -tracks/3/path = NodePath("%texture/../hitbox2:disabled") -tracks/3/interp = 1 -tracks/3/loop_wrap = true -tracks/3/keys = { -"times": PackedFloat32Array(0, 0.8, 1), -"transitions": PackedFloat32Array(1, 1, 1), -"update": 1, -"values": [true, false, true] -} -tracks/4/type = "value" -tracks/4/imported = false -tracks/4/enabled = true -tracks/4/path = NodePath("%texture/../hitbox3:disabled") -tracks/4/interp = 1 -tracks/4/loop_wrap = true -tracks/4/keys = { -"times": PackedFloat32Array(0, 1.2, 1.4, 1.45, 1.5), -"transitions": PackedFloat32Array(1, 1, 1, 1, 1), -"update": 1, -"values": [true, false, true, false, true] -} -tracks/5/type = "bezier" -tracks/5/imported = false -tracks/5/enabled = true -tracks/5/path = NodePath("anchor:scale:x") -tracks/5/interp = 1 -tracks/5/loop_wrap = true -tracks/5/keys = { +tracks/2/type = "bezier" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("anchor:scale:x") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { "handle_modes": PackedInt32Array(0, 0), "points": PackedFloat32Array(1, 0, 0, 0.2, 0, -1, 0, 0, 0, 0), "times": PackedFloat32Array(1.45, 1.7) } -tracks/6/type = "value" -tracks/6/imported = false -tracks/6/enabled = true -tracks/6/path = NodePath("%texture/..:usingDamageMultiplier") -tracks/6/interp = 1 -tracks/6/loop_wrap = true -tracks/6/keys = { +tracks/3/type = "value" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("%texture/..:usingDamageMultiplier") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { "times": PackedFloat32Array(0, 0.6, 1.2, 1.45), "transitions": PackedFloat32Array(1, 1, 1, 1), "update": 1, "values": [0, 1, 2, 3] } -tracks/7/type = "audio" -tracks/7/imported = false -tracks/7/enabled = true -tracks/7/path = NodePath("%textureSword/audio") -tracks/7/interp = 1 -tracks/7/loop_wrap = true -tracks/7/keys = { +tracks/4/type = "audio" +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/path = NodePath("%textureSword/audio") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/keys = { "clips": [{ "end_offset": 0.0, "start_offset": 0.0, @@ -219,14 +136,14 @@ tracks/7/keys = { }], "times": PackedFloat32Array(0, 0.6, 1.2, 1.45) } -tracks/7/use_blend = true -tracks/8/type = "method" -tracks/8/imported = false -tracks/8/enabled = true -tracks/8/path = NodePath("%texture/..") -tracks/8/interp = 1 -tracks/8/loop_wrap = true -tracks/8/keys = { +tracks/4/use_blend = true +tracks/5/type = "method" +tracks/5/imported = false +tracks/5/enabled = true +tracks/5/path = NodePath("%texture/..") +tracks/5/interp = 1 +tracks/5/loop_wrap = true +tracks/5/keys = { "times": PackedFloat32Array(1.65), "transitions": PackedFloat32Array(1), "values": [{ @@ -234,18 +151,6 @@ tracks/8/keys = { "method": &"generateShadow" }] } -tracks/9/type = "value" -tracks/9/imported = false -tracks/9/enabled = true -tracks/9/path = NodePath("%texture/../hitbox4:disabled") -tracks/9/interp = 1 -tracks/9/loop_wrap = true -tracks/9/keys = { -"times": PackedFloat32Array(0, 1.7), -"transitions": PackedFloat32Array(1, 1), -"update": 1, -"values": [true, false] -} [sub_resource type="AnimationLibrary" id="AnimationLibrary_w1utg"] _data = { @@ -254,18 +159,8 @@ _data = { &"spawn": SubResource("Animation_o5h0y") } -[sub_resource type="RectangleShape2D" id="RectangleShape2D_w1utg"] -size = Vector2(328, 34) - -[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_w1utg"] -radius = 66.75 -height = 322.0 - -[sub_resource type="CircleShape2D" id="CircleShape2D_w1utg"] -radius = 390.2512 - -[sub_resource type="RectangleShape2D" id="RectangleShape2D_6sp0s"] -size = Vector2(191, 66) +[sub_resource type="CircleShape2D" id="CircleShape2D_1sgli"] +radius = 78.05767 [node name="Volcano" instance=ExtResource("1_gd3m7")] script = ExtResource("2_w1utg") @@ -291,20 +186,13 @@ texture = ExtResource("2_wwxm2") [node name="audio" type="AudioStreamPlayer2D" parent="texture/anchor/textureSword" index="0"] -[node name="hitbox" parent="." index="1"] -position = Vector2(412, 0) -shape = SubResource("RectangleShape2D_w1utg") - -[node name="hitbox2" type="CollisionShape2D" parent="." index="2"] -position = Vector2(314, 0) -shape = SubResource("CapsuleShape2D_w1utg") -disabled = true - -[node name="hitbox3" type="CollisionShape2D" parent="." index="3"] -shape = SubResource("CircleShape2D_w1utg") -disabled = true - -[node name="hitbox4" type="CollisionShape2D" parent="." index="4"] -position = Vector2(308.5, -1) -shape = SubResource("RectangleShape2D_6sp0s") -disabled = true +[node name="hitbox" parent="." index="1" node_paths=PackedStringArray("target")] +position = Vector2(150, 0) +rotation = 1.5707964 +shape = SubResource("CircleShape2D_1sgli") +script = ExtResource("7_1sgli") +target = NodePath("../texture/anchor/textureSword") +offsetPosition = null +offsetRotation = 45.0 +enablePosition = true +enableRotation = true diff --git a/components/Effects/SwordCut.tscn b/components/Effects/SwordCut.tscn new file mode 100644 index 0000000..9b12a16 --- /dev/null +++ b/components/Effects/SwordCut.tscn @@ -0,0 +1,10 @@ +[gd_scene load_steps=3 format=3 uid="uid://bjr2xwsjlka3l"] + +[ext_resource type="PackedScene" uid="uid://bcvuuy2m0pke0" path="res://components/Abstracts/EffectBase.tscn" id="1_ncu2n"] +[ext_resource type="AudioStream" uid="uid://bj0nwb3nxmtot" path="res://resources/sounds/effect/cut.mp3" id="2_8pjoy"] + +[node name="SwordCut" instance=ExtResource("1_ncu2n")] +spawnSound = "spawn" + +[node name="spawn" parent="sounds" index="0"] +stream = ExtResource("2_8pjoy") diff --git a/resources/sounds/effect/cut.mp3 b/resources/sounds/effect/cut.mp3 new file mode 100644 index 0000000..05b2640 Binary files /dev/null and b/resources/sounds/effect/cut.mp3 differ diff --git a/resources/sounds/effect/cut.mp3.import b/resources/sounds/effect/cut.mp3.import new file mode 100644 index 0000000..462b150 --- /dev/null +++ b/resources/sounds/effect/cut.mp3.import @@ -0,0 +1,19 @@ +[remap] + +importer="mp3" +type="AudioStreamMP3" +uid="uid://bj0nwb3nxmtot" +path="res://.godot/imported/cut.mp3-1bfbc1fc5e5c87ac6972a4334d51c8c8.mp3str" + +[deps] + +source_file="res://resources/sounds/effect/cut.mp3" +dest_files=["res://.godot/imported/cut.mp3-1bfbc1fc5e5c87ac6972a4334d51c8c8.mp3str"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/scripts/Contents/Bullets/Volcano.gd b/scripts/Contents/Bullets/Volcano.gd index a9b8972..b57c9b8 100644 --- a/scripts/Contents/Bullets/Volcano.gd +++ b/scripts/Contents/Bullets/Volcano.gd @@ -9,16 +9,15 @@ var count: int = 0 var dmg5: float = 0 var splitAngle: float = 10 -func register(): - setupCuttable(0.7) func ai(): - animator.speed_scale = launcher.fields.get(FieldStore.Entity.ATTACK_SPEED) * speedScale PresetBulletAI.lockLauncher(self, launcher, true) rotation = lerp_angle( rotation, position.angle_to_point(get_global_mouse_position()), rotates ) +func succeedToHit(_dmg: float, _entity: EntityBase): + EffectController.create(ComponentManager.getEffect("SwordCut"), textureSword.global_position).shot() func generateShadow(): var startAngle = rotation - deg_to_rad(count * splitAngle / 2) diff --git a/scripts/Statemachine/FollowPosition.gd b/scripts/Statemachine/FollowPosition.gd new file mode 100644 index 0000000..a369d8b --- /dev/null +++ b/scripts/Statemachine/FollowPosition.gd @@ -0,0 +1,15 @@ +@tool +extends Node2D + +@export var target: Node2D +@export var offsetPosition: Vector2 = Vector2.ZERO +@export var offsetRotation: float = 0.0 +@export var enablePosition: bool = false +@export var enableRotation: bool = false + +func _process(_delta): + if is_instance_valid(target): + if enablePosition: + global_position = target.global_position + offsetPosition + if enableRotation: + global_rotation = target.global_rotation + deg_to_rad(offsetRotation) diff --git a/scripts/Statemachine/FollowPosition.gd.uid b/scripts/Statemachine/FollowPosition.gd.uid new file mode 100644 index 0000000..e336acf --- /dev/null +++ b/scripts/Statemachine/FollowPosition.gd.uid @@ -0,0 +1 @@ +uid://ckc6guqib3rno