Animations and bug fixes
- Converted the rock throw animation to the new system - Converted the fireball animation to the new system (needs to be inverted still) - Spell variable now get set to null after use or they get interrupted - Made some code more readable
This commit is contained in:
parent
8003a7643b
commit
847a41eaad
@ -22,7 +22,7 @@ allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=1
|
||||
oversampling=8.0
|
||||
oversampling=10.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
|
@ -12,7 +12,6 @@ animation = "res://Scenes/Animations/fireballAnim.tscn"
|
||||
damage = 8.0
|
||||
backfireStrength = 6.0
|
||||
castCombo = Array[String](["up", "down", "down", "left", "right", "left", "right", "up"])
|
||||
castProgress = 0
|
||||
element = 1
|
||||
stunning = true
|
||||
timeout = 5.0
|
||||
|
@ -12,7 +12,6 @@ animation = "res://Scenes/Animations/rockThrowAnim.tscn"
|
||||
damage = 0.5
|
||||
backfireStrength = 1.0
|
||||
castCombo = Array[String](["down", "up", "up"])
|
||||
castProgress = 0
|
||||
element = 4
|
||||
stunning = true
|
||||
timeout = 10.0
|
||||
|
@ -1,15 +1,9 @@
|
||||
[gd_scene load_steps=69 format=3 uid="uid://dct5w5mffqmlm"]
|
||||
[gd_scene load_steps=86 format=3 uid="uid://dct5w5mffqmlm"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/Animations/fireballAnim.gd" id="1_eh23w"]
|
||||
[ext_resource type="Texture2D" uid="uid://s1wipkprymf7" path="res://Sprites/Particles/Particles Cleaned/16_sunburn_spritesheet.png" id="2_a2rii"]
|
||||
[ext_resource type="Texture2D" uid="uid://df1rqga22alvj" path="res://Sprites/Particles/Particles Cleaned/Effect_BigHit_1_557x553.png" id="3_unynm"]
|
||||
|
||||
[sub_resource type="Curve2D" id="Curve2D_chn67"]
|
||||
_data = {
|
||||
"points": PackedVector2Array(0, 0, 0, 0, 253, 283, 0, 0, 0, 0, 249, 56, 0, 0, 0, 0, 883, 258)
|
||||
}
|
||||
point_count = 3
|
||||
|
||||
[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_6walw"]
|
||||
particles_animation = true
|
||||
particles_anim_h_frames = 6
|
||||
@ -462,30 +456,274 @@ animations = [{
|
||||
"speed": 60.0
|
||||
}]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_r8anb"]
|
||||
resource_name = "attackSegment0"
|
||||
length = 0.1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("AnimatedSprite2D:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 2,
|
||||
"values": [Vector2(253, 283), Vector2(253, 241)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("AnimatedSprite2D:scale")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(1e-05, 1e-05), Vector2(0.2, 0.2)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_7m6oo"]
|
||||
resource_name = "attackSegment1"
|
||||
length = 0.2
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("AnimatedSprite2D:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(253, 241), Vector2(253, 210)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("AnimatedSprite2D:scale")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.2, 0.2), Vector2(0.6, 0.6)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_jvbiy"]
|
||||
resource_name = "attackSegment2"
|
||||
length = 0.1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("AnimatedSprite2D:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(253, 210), Vector2(253, 146)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("AnimatedSprite2D:scale")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.6, 0.6), Vector2(1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_l7vac"]
|
||||
resource_name = "attackSegment3"
|
||||
length = 0.1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("AnimatedSprite2D:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(253, 146), Vector2(253, 104)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("AnimatedSprite2D:scale")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(1, 1), Vector2(2.2, 2.2)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_yc0ak"]
|
||||
resource_name = "attackSegment4"
|
||||
length = 0.1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("AnimatedSprite2D:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(2.2, 2.2), Vector2(3.4, 3.4)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_gnoe5"]
|
||||
resource_name = "attackSegment5"
|
||||
length = 0.1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("AnimatedSprite2D:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(3.4, 3.4), Vector2(4.8, 4.8)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_46ufo"]
|
||||
resource_name = "attackSegment6"
|
||||
length = 0.1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("AnimatedSprite2D:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(4.8, 4.8), Vector2(7, 7)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_y4mhj"]
|
||||
resource_name = "attackSegment7"
|
||||
length = 0.5
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("AnimatedSprite2D:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.5),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(253, 104), Vector2(896, 286)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_wf5px"]
|
||||
resource_name = "attackInverse0"
|
||||
|
||||
[sub_resource type="Animation" id="Animation_yy8ft"]
|
||||
resource_name = "attackInverse1"
|
||||
|
||||
[sub_resource type="Animation" id="Animation_v42n0"]
|
||||
resource_name = "attackInverse2"
|
||||
|
||||
[sub_resource type="Animation" id="Animation_vxtqp"]
|
||||
resource_name = "attackInverse3"
|
||||
|
||||
[sub_resource type="Animation" id="Animation_if6re"]
|
||||
resource_name = "attackInverse4"
|
||||
|
||||
[sub_resource type="Animation" id="Animation_y406p"]
|
||||
resource_name = "attackInverse5"
|
||||
|
||||
[sub_resource type="Animation" id="Animation_et7ce"]
|
||||
resource_name = "attackInverse6"
|
||||
|
||||
[sub_resource type="Animation" id="Animation_e75l3"]
|
||||
resource_name = "attackInverse7"
|
||||
|
||||
[sub_resource type="Animation" id="Animation_wgnw8"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("AnimatedSprite2D:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(253, 241)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("AnimatedSprite2D:scale")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.2, 0.2)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_r6j4e"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_wgnw8"),
|
||||
"attackInverse0": SubResource("Animation_wf5px"),
|
||||
"attackInverse1": SubResource("Animation_yy8ft"),
|
||||
"attackInverse2": SubResource("Animation_v42n0"),
|
||||
"attackInverse3": SubResource("Animation_vxtqp"),
|
||||
"attackInverse4": SubResource("Animation_if6re"),
|
||||
"attackInverse5": SubResource("Animation_y406p"),
|
||||
"attackInverse6": SubResource("Animation_et7ce"),
|
||||
"attackInverse7": SubResource("Animation_e75l3"),
|
||||
"attackSegment0": SubResource("Animation_r8anb"),
|
||||
"attackSegment1": SubResource("Animation_7m6oo"),
|
||||
"attackSegment2": SubResource("Animation_jvbiy"),
|
||||
"attackSegment3": SubResource("Animation_l7vac"),
|
||||
"attackSegment4": SubResource("Animation_yc0ak"),
|
||||
"attackSegment5": SubResource("Animation_gnoe5"),
|
||||
"attackSegment6": SubResource("Animation_46ufo"),
|
||||
"attackSegment7": SubResource("Animation_y4mhj")
|
||||
}
|
||||
|
||||
[node name="FireballAnim" type="Node2D"]
|
||||
script = ExtResource("1_eh23w")
|
||||
startPrimaryLoc = Vector2(193, 137)
|
||||
startSecondaryLoc = Vector2(350, 137)
|
||||
fullSize = 7.0
|
||||
finalIndex = 8
|
||||
|
||||
[node name="Path2D" type="Path2D" parent="."]
|
||||
curve = SubResource("Curve2D_chn67")
|
||||
|
||||
[node name="PathFollow2D" type="PathFollow2D" parent="Path2D"]
|
||||
position = Vector2(253, 283)
|
||||
rotation = -1.5708
|
||||
rotates = false
|
||||
loop = false
|
||||
|
||||
[node name="GPUParticles2D" type="GPUParticles2D" parent="Path2D/PathFollow2D"]
|
||||
[node name="GPUParticles2D" type="GPUParticles2D" parent="."]
|
||||
material = SubResource("CanvasItemMaterial_6walw")
|
||||
rotation = 1.5708
|
||||
position = Vector2(253, 283)
|
||||
emitting = false
|
||||
process_material = SubResource("ParticleProcessMaterial_cjfl8")
|
||||
texture = ExtResource("3_unynm")
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="Path2D/PathFollow2D"]
|
||||
rotation = 1.5708
|
||||
scale = Vector2(1e-05, 1e-05)
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(253, 241)
|
||||
scale = Vector2(0.2, 0.2)
|
||||
sprite_frames = SubResource("SpriteFrames_xup3y")
|
||||
autoplay = "default"
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_r6j4e")
|
||||
}
|
||||
|
||||
[connection signal="animation_finished" from="AnimationPlayer" to="." method="animFinished"]
|
||||
|
@ -1,7 +1,8 @@
|
||||
[gd_scene load_steps=11 format=3 uid="uid://c44hesqr12wxd"]
|
||||
[gd_scene load_steps=15 format=3 uid="uid://c44hesqr12wxd"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/Animations/rockThrowAnim.gd" id="1_owh0v"]
|
||||
[ext_resource type="Texture2D" uid="uid://dwsd0hggrxbdq" path="res://Sprites/Animations/Rock Pack/Rocks 64x64 by Captainskeleto.png" id="2_addwy"]
|
||||
[ext_resource type="Resource" uid="uid://dl6nv6lp460n3" path="res://Resources/Spells/rockThrow.tres" id="2_apcu7"]
|
||||
|
||||
[sub_resource type="Curve2D" id="Curve2D_m36l3"]
|
||||
_data = {
|
||||
@ -13,12 +14,6 @@ point_count = 8
|
||||
atlas = ExtResource("2_addwy")
|
||||
region = Rect2(128, 192, 64, 64)
|
||||
|
||||
[sub_resource type="Curve2D" id="Curve2D_gdix6"]
|
||||
_data = {
|
||||
"points": PackedVector2Array(0, 0, 0, 0, 371, 664, 0, 0, 0, 0, 370, 481, 0, 0, 0, 0, 373, 311, 0, 0, 0, 0, 882, 362)
|
||||
}
|
||||
point_count = 4
|
||||
|
||||
[sub_resource type="Animation" id="Animation_7dh1k"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
@ -34,25 +29,9 @@ tracks/0/keys = {
|
||||
"values": [Vector2(342, 645)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_cfsn4"]
|
||||
resource_name = "attackSegment1"
|
||||
length = 0.5
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("TextureRect:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = false
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.49),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 2,
|
||||
"values": [Vector2(342, 645), Vector2(342, 440)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_uphdx"]
|
||||
resource_name = "attackSegment2"
|
||||
length = 0.5
|
||||
[sub_resource type="Animation" id="Animation_5o8xe"]
|
||||
resource_name = "attackInverse0"
|
||||
length = 0.3
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
@ -60,14 +39,78 @@ tracks/0/path = NodePath("TextureRect:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.5),
|
||||
"times": PackedFloat32Array(0, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(760, 645), Vector2(760, 440)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_clfp2"]
|
||||
resource_name = "attackInverse1"
|
||||
length = 0.3
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("TextureRect:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(760, 440), Vector2(760, 280)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_hypvd"]
|
||||
resource_name = "attackInverse2"
|
||||
length = 0.23
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("TextureRect:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(760, 280), Vector2(342, 331)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_cfsn4"]
|
||||
resource_name = "attackSegment0"
|
||||
length = 0.3
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("TextureRect:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = false
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 2,
|
||||
"values": [Vector2(342, 645), Vector2(342, 440)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_uphdx"]
|
||||
resource_name = "attackSegment1"
|
||||
length = 0.3
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("TextureRect:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(342, 440), Vector2(342, 280)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_mlgwv"]
|
||||
resource_name = "attackSegment3"
|
||||
resource_name = "attackSegment2"
|
||||
length = 0.23
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
@ -82,16 +125,25 @@ tracks/0/keys = {
|
||||
"values": [Vector2(342, 280), Vector2(852, 331)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_y7nwk"]
|
||||
resource_name = "fail"
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_cg24k"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_7dh1k"),
|
||||
"attackSegment1": SubResource("Animation_cfsn4"),
|
||||
"attackSegment2": SubResource("Animation_uphdx"),
|
||||
"attackSegment3": SubResource("Animation_mlgwv")
|
||||
"attackInverse0": SubResource("Animation_5o8xe"),
|
||||
"attackInverse1": SubResource("Animation_clfp2"),
|
||||
"attackInverse2": SubResource("Animation_hypvd"),
|
||||
"attackSegment0": SubResource("Animation_cfsn4"),
|
||||
"attackSegment1": SubResource("Animation_uphdx"),
|
||||
"attackSegment2": SubResource("Animation_mlgwv"),
|
||||
"fail": SubResource("Animation_y7nwk")
|
||||
}
|
||||
|
||||
[node name="RockThrowAnim" type="Node2D"]
|
||||
script = ExtResource("1_owh0v")
|
||||
finalIndex = 3
|
||||
spell = ExtResource("2_apcu7")
|
||||
|
||||
[node name="Path2D2" type="Path2D" parent="."]
|
||||
position = Vector2(339, 632)
|
||||
@ -118,14 +170,6 @@ grow_vertical = 2
|
||||
pivot_offset = Vector2(31.8413, 32.0651)
|
||||
texture = SubResource("AtlasTexture_wqvpx")
|
||||
|
||||
[node name="Path2D" type="Path2D" parent="."]
|
||||
curve = SubResource("Curve2D_gdix6")
|
||||
|
||||
[node name="PathFollow2D" type="PathFollow2D" parent="Path2D"]
|
||||
position = Vector2(371, 664)
|
||||
rotates = false
|
||||
loop = false
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_cg24k")
|
||||
|
@ -1,13 +1,10 @@
|
||||
extends "res://Scripts/animationBase.gd"
|
||||
extends AnimationBase
|
||||
|
||||
@export var startPrimaryLoc: Vector2
|
||||
@export var startSecondaryLoc: Vector2
|
||||
@export var fullSize: float = 1
|
||||
@export var explodeDur: float = 0.2
|
||||
@onready var ballofayr: AnimatedSprite2D = $Path2D/PathFollow2D/AnimatedSprite2D
|
||||
@onready var path: PathFollow2D = $Path2D/PathFollow2D
|
||||
@onready var particles: GPUParticles2D = $Path2D/PathFollow2D/GPUParticles2D
|
||||
var dir: int = 1
|
||||
@onready var ballofayr: AnimatedSprite2D = $AnimatedSprite2D
|
||||
@onready var animationPlayer: AnimationPlayer = $AnimationPlayer
|
||||
@onready var particles: GPUParticles2D = $GPUParticles2D
|
||||
|
||||
var exploding: bool = false
|
||||
var timer: float = 0
|
||||
var size: Vector2 = Vector2(0, 0)
|
||||
@ -15,36 +12,34 @@ var size: Vector2 = Vector2(0, 0)
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
if inverted:
|
||||
dir = -1
|
||||
ballofayr.position = startSecondaryLoc
|
||||
attackName = inverseName
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
if !exploding:
|
||||
if (targetProg / finalProg < 0.3):
|
||||
timer = clampf(timer + delta, 0, clampf(targetProg / finalProg, 0, 0.25))
|
||||
path.progress_ratio = timer
|
||||
if (targetProg / finalProg < 0.9):
|
||||
ballofayr.scale = lerp(ballofayr.scale, Vector2((targetProg / finalProg) * fullSize, (targetProg / finalProg) * fullSize), delta * 2)
|
||||
if (targetProg / finalProg >= 0.9):
|
||||
timer = clampf(timer + delta, 0, targetProg / finalProg)
|
||||
path.progress_ratio = timer
|
||||
if path.progress_ratio == 1:
|
||||
explode()
|
||||
else:
|
||||
if (exploding):
|
||||
timer += delta
|
||||
if timer > explodeDur:
|
||||
self.free()
|
||||
self.queue_free()
|
||||
|
||||
func setProgress(target: float, final: float = finalProg) -> void:
|
||||
targetProg = target
|
||||
finalProg = final
|
||||
if (index > -1):
|
||||
animationPlayer.queue(attackName + str(index))
|
||||
index += 1
|
||||
|
||||
func explode() -> void:
|
||||
particles.position = ballofayr.position
|
||||
ballofayr.hide()
|
||||
particles.emitting = true
|
||||
exploding = true
|
||||
timer = 0
|
||||
|
||||
func animFinished(s: String):
|
||||
print("Animation finished with indices " + str(index) + " and " + str(finalIndex))
|
||||
if (index == finalIndex):
|
||||
animationFinished.emit(spell)
|
||||
explode()
|
||||
|
||||
func castFailed() -> void:
|
||||
explode()
|
||||
|
@ -1,4 +1,4 @@
|
||||
extends "res://Scripts/animationBase.gd"
|
||||
extends AnimationBase
|
||||
|
||||
@onready var texture: TextureRect = $TextureRect
|
||||
@onready var animationPlayer: AnimationPlayer = $AnimationPlayer
|
||||
@ -9,51 +9,19 @@ var animQueue: Queue = Queue.new()
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
if inverted:
|
||||
pass
|
||||
#texture.position.x = (-(texture.position.x - 571)) + 571
|
||||
#for point: Vector2 in path:
|
||||
#point.x = (-(point.x - 571)) + 571
|
||||
#for point: Vector2 in failPath:
|
||||
#point.x = (-(point.x - 571)) + 571
|
||||
#if !inverted:
|
||||
#pass
|
||||
#path = $Path2D/PathFollow2D
|
||||
#failPath = $Path2D/PathFollow2D/Path2D/PathFollow2D
|
||||
#else:
|
||||
#pass
|
||||
#path = $Path2D/PathFollow2D
|
||||
#failPath = $Path2D/PathFollow2D/Path2D/PathFollow2D
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
pass
|
||||
#if casting:
|
||||
#if targetProg / finalProg < 0.7:
|
||||
#timer = clampf(timer + delta, 0, clampf(targetProg / finalProg, 0, 0.35))
|
||||
#path.progress_ratio = timer
|
||||
#else:
|
||||
#timer = clampf(timer + delta, 0, 1)
|
||||
#path.progress_ratio = timer
|
||||
#if path.progress_ratio == 1:
|
||||
#self.free()
|
||||
#else:
|
||||
#timer = clampf(timer + (1.25 * delta), 0, 1)
|
||||
#failPath.progress_ratio = timer
|
||||
#if failPath.progress_ratio == 1:
|
||||
#self.free()
|
||||
attackName = inverseName
|
||||
|
||||
func castFailed() -> void:
|
||||
queue_free()
|
||||
#casting = false
|
||||
#timer = 0
|
||||
#texture.get_parent().remove_child(texture)
|
||||
#failPath.add_child(texture)
|
||||
|
||||
func setProgress(target: float, final: float = finalProg) -> void:
|
||||
targetProg = target
|
||||
finalProg = final
|
||||
animQueue.push("attackSegment" + str(target))
|
||||
if (index > -1):
|
||||
animationPlayer.queue(attackName + str(index))
|
||||
index += 1
|
||||
|
||||
func animFinished(_animName):
|
||||
if (animQueue.size() > 0):
|
||||
animationPlayer.play(animQueue.pop())
|
||||
func animFinished(s: String):
|
||||
if (index == finalIndex):
|
||||
animationFinished.emit(spell)
|
||||
queue_free()
|
||||
|
@ -1,8 +1,14 @@
|
||||
extends Node2D
|
||||
class_name AnimationBase extends Node2D
|
||||
|
||||
class_name AnimationBase
|
||||
signal animationFinished(spell: Spell)
|
||||
|
||||
@export var inverted: bool = false
|
||||
@export var index: int = -1
|
||||
@export var finalIndex: int = 0
|
||||
@export var spell: Spell
|
||||
var attackName: String = "attackSegment"
|
||||
var inverseName: String = "attackInverse"
|
||||
|
||||
var targetProg: float
|
||||
var finalProg: float
|
||||
|
||||
|
@ -23,9 +23,9 @@ var castProgress: int = 0
|
||||
func _ready():
|
||||
renderer.animation_finished.connect(animationFinished)
|
||||
renderer.play("idle")
|
||||
spellbook.initCooldowns()
|
||||
healthbar.maxHealth = maxHealth
|
||||
if !player:
|
||||
spellbook.initCooldowns()
|
||||
for spel: Spell in spellbook.spells:
|
||||
if (spel == null): continue
|
||||
if !data.animations.has(spel.animation):
|
||||
@ -60,117 +60,98 @@ func cast() -> void:
|
||||
match data.difficulty:
|
||||
Data.Difficulty.EASY:
|
||||
spellIndex = randi_range(0, spellbook.spells.size() - 1)
|
||||
spell = spellbook.spells[spellIndex]
|
||||
anim = data.animations[spell.animation].instantiate()
|
||||
anim.setProgress(0, spell.castCombo.size())
|
||||
anim.inverted = true
|
||||
get_node("/root").add_child(anim)
|
||||
attemptCast()
|
||||
Data.Difficulty.NORMAL:
|
||||
spellIndex = randi_range(0, spellbook.spells.size() - 1)
|
||||
spell = spellbook.spells[spellIndex]
|
||||
anim = data.animations[spell.animation].instantiate()
|
||||
anim.setProgress(0, spell.castCombo.size())
|
||||
anim.inverted = true
|
||||
get_node("/root").add_child(anim)
|
||||
attemptCast()
|
||||
Data.Difficulty.HARD:
|
||||
spellIndex = randi_range(0, spellbook.spells.size() - 1)
|
||||
spell = spellbook.spells[spellIndex]
|
||||
anim = data.animations[spell.animation].instantiate()
|
||||
anim.setProgress(0, spell.castCombo.size())
|
||||
anim.inverted = true
|
||||
get_node("/root").add_child(anim)
|
||||
attemptCast()
|
||||
Data.Difficulty.GAMER:
|
||||
spellIndex = randi_range(0, spellbook.spells.size() - 1)
|
||||
spell = spellbook.spells[spellIndex]
|
||||
anim = data.animations[spell.animation].instantiate()
|
||||
anim.setProgress(0, spell.castCombo.size())
|
||||
anim.inverted = true
|
||||
anim.spell = spell
|
||||
anim.connect("animationFinished", finalizeSpell)
|
||||
get_node("/root").add_child(anim)
|
||||
attemptCast()
|
||||
|
||||
func attemptCast():
|
||||
#if (!casting):
|
||||
#_finishedCasting()
|
||||
#return
|
||||
match data.difficulty:
|
||||
Data.Difficulty.EASY:
|
||||
await get_tree().create_timer(randf_range(0.5, 1.5)).timeout
|
||||
await get_tree().create_timer(randf_range(0.75, 1.75)).timeout
|
||||
if (spell == null): return
|
||||
if randi_range(0, 99) < 90:
|
||||
castProgress += 1
|
||||
anim.setProgress(castProgress)
|
||||
if (is_instance_valid(anim)): anim.setProgress(castProgress)
|
||||
|
||||
if castProgress == spell.castCombo.size():
|
||||
if (castProgress == spell.castCombo.size()):
|
||||
casting = false
|
||||
castProgress = 0
|
||||
renderer.play("attack1")
|
||||
spellbook.cooldowns[spellIndex] = spell.cooldown
|
||||
data.player.alterHealth(-spell.damage, false)
|
||||
_finishedCasting()
|
||||
return
|
||||
else:
|
||||
attemptCast()
|
||||
else:
|
||||
alterHealth(-spell.backfireStrength, true)
|
||||
casting = false
|
||||
anim.castFailed()
|
||||
castProgress = 0
|
||||
spellbook.cooldowns[spellIndex] = spell.cooldown * (float(castProgress) / float(spell.castCombo.size()))
|
||||
_finishedCasting()
|
||||
failCast()
|
||||
return
|
||||
Data.Difficulty.NORMAL:
|
||||
await get_tree().create_timer(randf_range(0.4, 1)).timeout
|
||||
await get_tree().create_timer(randf_range(0.6, 1.2)).timeout
|
||||
if (spell == null): return
|
||||
if randi_range(0, 99) < 95:
|
||||
castProgress += 1
|
||||
anim.setProgress(castProgress)
|
||||
if (is_instance_valid(anim)): anim.setProgress(castProgress)
|
||||
|
||||
if castProgress == spell.castCombo.size():
|
||||
if (castProgress == spell.castCombo.size()):
|
||||
casting = false
|
||||
castProgress = 0
|
||||
renderer.play("attack1")
|
||||
spellbook.cooldowns[spellIndex] = spell.cooldown
|
||||
data.player.alterHealth(-spell.damage, false)
|
||||
_finishedCasting()
|
||||
return
|
||||
else:
|
||||
attemptCast()
|
||||
else:
|
||||
alterHealth(-spell.backfireStrength, true)
|
||||
casting = false
|
||||
anim.castFailed()
|
||||
castProgress = 0
|
||||
spellbook.cooldowns[spellIndex] = spell.cooldown * (float(castProgress) / float(spell.castCombo.size()))
|
||||
_finishedCasting()
|
||||
failCast()
|
||||
Data.Difficulty.HARD:
|
||||
await get_tree().create_timer(randf_range(0.2, 0.6)).timeout
|
||||
await get_tree().create_timer(randf_range(0.3, 0.75)).timeout
|
||||
if (spell == null): return
|
||||
if randi_range(0, 99) < 98:
|
||||
castProgress += 1
|
||||
anim.setProgress(castProgress)
|
||||
if (is_instance_valid(anim)): anim.setProgress(castProgress)
|
||||
|
||||
if castProgress == spell.castCombo.size():
|
||||
if (castProgress == spell.castCombo.size()):
|
||||
casting = false
|
||||
castProgress = 0
|
||||
renderer.play("attack1")
|
||||
spellbook.cooldowns[spellIndex] = spell.cooldown
|
||||
data.player.alterHealth(-spell.damage, false)
|
||||
_finishedCasting()
|
||||
return
|
||||
else:
|
||||
attemptCast()
|
||||
else:
|
||||
alterHealth(-spell.backfireStrength, true)
|
||||
casting = false
|
||||
anim.castFailed()
|
||||
castProgress = 0
|
||||
spellbook.cooldowns[spellIndex] = spell.cooldown * (float(castProgress) / float(spell.castCombo.size()))
|
||||
_finishedCasting()
|
||||
failCast()
|
||||
Data.Difficulty.GAMER:
|
||||
await get_tree().create_timer(.1).timeout
|
||||
await get_tree().create_timer(.2).timeout
|
||||
if (spell == null): return
|
||||
castProgress += 1
|
||||
anim.setProgress(castProgress)
|
||||
if (is_instance_valid(anim)): anim.setProgress(castProgress)
|
||||
|
||||
if castProgress == spell.castCombo.size():
|
||||
if (castProgress == spell.castCombo.size()):
|
||||
casting = false
|
||||
castProgress = 0
|
||||
renderer.play("attack1")
|
||||
spellbook.cooldowns[spellIndex] = spell.cooldown
|
||||
data.player.alterHealth(-spell.damage, false)
|
||||
_finishedCasting()
|
||||
return
|
||||
else:
|
||||
attemptCast()
|
||||
|
||||
@ -181,7 +162,24 @@ func alterHealth(change: float, stun: bool) -> void:
|
||||
renderer.play("hit")
|
||||
if player:
|
||||
stunned.emit()
|
||||
else:
|
||||
failCast()
|
||||
healthChanged.emit(health)
|
||||
|
||||
func failCast() -> void:
|
||||
casting = false
|
||||
if (is_instance_valid(anim)): anim.castFailed()
|
||||
castProgress = 0
|
||||
if (spell != null): spellbook.cooldowns[spellIndex] = spell.cooldown * (float(castProgress) / float(spell.castCombo.size()))
|
||||
spell = null
|
||||
_finishedCasting()
|
||||
return
|
||||
|
||||
func animationFinished() -> void:
|
||||
renderer.play("idle")
|
||||
|
||||
func finalizeSpell(finish: Spell) -> void:
|
||||
if (player):
|
||||
data.opponent.alterHealth(-finish.damage, finish.stunning)
|
||||
else:
|
||||
data.player.alterHealth(-finish.damage, finish.stunning)
|
||||
|
@ -33,6 +33,8 @@ func _process(delta):
|
||||
castIndicator.setDirs(spell.castCombo[0], spell.castCombo[1])
|
||||
anim = data.animations[spell.animation].instantiate()
|
||||
anim.setProgress(0, spell.castCombo.size())
|
||||
anim.spell = spell
|
||||
anim.connect("animationFinished", avatar.finalizeSpell)
|
||||
get_node("/root").add_child(anim)
|
||||
timer = 0
|
||||
else:
|
||||
@ -52,21 +54,19 @@ func _process(delta):
|
||||
avatar.renderer.play("attack1")
|
||||
data.spellbook.cooldowns[spellIndex] = spell.cooldown
|
||||
castIndicator.hide()
|
||||
data.opponent.alterHealth(-spell.damage, false)
|
||||
elif (timer >= spell.timeout || Input.is_action_just_pressed("up") || Input.is_action_just_pressed("down") || Input.is_action_just_pressed("left") || Input.is_action_just_pressed("right")):
|
||||
avatar.alterHealth(-spell.backfireStrength, true)
|
||||
casting = false
|
||||
anim.castFailed()
|
||||
avatar.castProgress = 0
|
||||
data.spellbook.cooldowns[spellIndex] = spell.cooldown * (float(avatar.castProgress) / float(spell.castCombo.size()))
|
||||
castIndicator.hide()
|
||||
stunned()
|
||||
|
||||
for i in range(data.spellbook.cooldowns.size()):
|
||||
data.spellbook.cooldowns[i] -= delta
|
||||
if data.spellbook.cooldowns[i] < 0: data.spellbook.cooldowns[i] = 0
|
||||
|
||||
func stunned():
|
||||
if (!casting): return
|
||||
casting = false
|
||||
avatar.castProgress = 0
|
||||
anim.castFailed()
|
||||
data.spellbook.cooldowns[spellIndex] = spell.cooldown * (float(avatar.castProgress) / float(spell.castCombo.size()))
|
||||
castIndicator.hide()
|
||||
spell = null
|
||||
|
@ -17,8 +17,9 @@ config/icon="res://icon.svg"
|
||||
|
||||
[display]
|
||||
|
||||
window/size/mode=3
|
||||
window/stretch/mode="canvas_items"
|
||||
window/stretch/aspect="keep_width"
|
||||
window/stretch/aspect="keep_height"
|
||||
mouse_cursor/custom_image_hotspot=Vector2(64, 128)
|
||||
|
||||
[dotnet]
|
||||
|
Loading…
x
Reference in New Issue
Block a user