mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-21 13:23:47 +00:00
Boss Animation
This commit is contained in:
parent
2e01cd19e2
commit
08cc298a81
9 changed files with 139 additions and 13 deletions
|
|
@ -7,8 +7,8 @@
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_lrvah"]
|
[sub_resource type="Resource" id="Resource_lrvah"]
|
||||||
script = ExtResource("1_xksf5")
|
script = ExtResource("1_xksf5")
|
||||||
relativeTargetPosition = Vector2(0, 0)
|
relativeTargetPosition = Vector2(0, -1)
|
||||||
moveDuration = 2.0
|
moveDuration = 1.0
|
||||||
transitionType = 0
|
transitionType = 0
|
||||||
easeType = 2
|
easeType = 2
|
||||||
WaitForCompletion = true
|
WaitForCompletion = true
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=12 format=3 uid="uid://d1rlw6ddpmrn8"]
|
[gd_scene load_steps=20 format=3 uid="uid://d1rlw6ddpmrn8"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://bjs2u8gogvs03" path="res://Scripts/Actors/Boss.cs" id="1_na4uq"]
|
[ext_resource type="Script" uid="uid://bjs2u8gogvs03" path="res://Scripts/Actors/Boss.cs" id="1_na4uq"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bcqgke6dthlrj" path="res://Sprites/Actors/Rumia.png" id="2_7k5gp"]
|
[ext_resource type="Texture2D" uid="uid://bcqgke6dthlrj" path="res://Sprites/Actors/Rumia.png" id="2_7k5gp"]
|
||||||
|
|
@ -7,6 +7,67 @@
|
||||||
[ext_resource type="PackedScene" uid="uid://cuixq5ex0j40h" path="res://Scenes/enemyBullet.tscn" id="5_g1p0m"]
|
[ext_resource type="PackedScene" uid="uid://cuixq5ex0j40h" path="res://Scenes/enemyBullet.tscn" id="5_g1p0m"]
|
||||||
[ext_resource type="Resource" uid="uid://d2l607uabv3d6" path="res://Resources/BossPhases/Rumia_Boss_Script.tres" id="6_ifwrk"]
|
[ext_resource type="Resource" uid="uid://d2l607uabv3d6" path="res://Resources/BossPhases/Rumia_Boss_Script.tres" id="6_ifwrk"]
|
||||||
[ext_resource type="Script" uid="uid://c6467d6yx50qh" path="res://Scripts/Components/BulletSpawner.cs" id="7_2obh7"]
|
[ext_resource type="Script" uid="uid://c6467d6yx50qh" path="res://Scripts/Components/BulletSpawner.cs" id="7_2obh7"]
|
||||||
|
[ext_resource type="Script" uid="uid://dtg2vhquyrib3" path="res://Scripts/Components/Actors/BossSpriteAnimator.cs" id="8_vqdji"]
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_vqdji"]
|
||||||
|
atlas = ExtResource("2_7k5gp")
|
||||||
|
region = Rect2(0, 64, 16, 32)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_egx0r"]
|
||||||
|
atlas = ExtResource("2_7k5gp")
|
||||||
|
region = Rect2(16, 64, 16, 32)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_opbj8"]
|
||||||
|
atlas = ExtResource("2_7k5gp")
|
||||||
|
region = Rect2(0, 32, 16, 32)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_7asmc"]
|
||||||
|
atlas = ExtResource("2_7k5gp")
|
||||||
|
region = Rect2(16, 32, 16, 32)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ikvnf"]
|
||||||
|
atlas = ExtResource("2_7k5gp")
|
||||||
|
region = Rect2(0, 0, 16, 32)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ifwrk"]
|
||||||
|
atlas = ExtResource("2_7k5gp")
|
||||||
|
region = Rect2(16, 0, 16, 32)
|
||||||
|
|
||||||
|
[sub_resource type="SpriteFrames" id="SpriteFrames_opbj8"]
|
||||||
|
animations = [{
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_vqdji")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_egx0r")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"Left",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_opbj8")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_7asmc")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"Right",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_ikvnf")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_ifwrk")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"default",
|
||||||
|
"speed": 5.0
|
||||||
|
}]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_8gtts"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_8gtts"]
|
||||||
radius = 7.0
|
radius = 7.0
|
||||||
|
|
@ -30,8 +91,12 @@ CameraOffset = Vector2(0, 32)
|
||||||
Health = 200.0
|
Health = 200.0
|
||||||
metadata/_edit_group_ = true
|
metadata/_edit_group_ = true
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||||
texture = ExtResource("2_7k5gp")
|
sprite_frames = SubResource("SpriteFrames_opbj8")
|
||||||
|
animation = &"Left"
|
||||||
|
autoplay = "default"
|
||||||
|
frame = 1
|
||||||
|
frame_progress = 0.41097
|
||||||
|
|
||||||
[node name="Damage_HitBox" type="CollisionShape2D" parent="."]
|
[node name="Damage_HitBox" type="CollisionShape2D" parent="."]
|
||||||
visible = false
|
visible = false
|
||||||
|
|
@ -80,6 +145,13 @@ shape = SubResource("RectangleShape2D_m1rsg")
|
||||||
script = ExtResource("7_2obh7")
|
script = ExtResource("7_2obh7")
|
||||||
BulletScene = ExtResource("5_g1p0m")
|
BulletScene = ExtResource("5_g1p0m")
|
||||||
|
|
||||||
|
[node name="BossSpriteAnimator" type="Node2D" parent="." node_paths=PackedStringArray("AnimatedSprite2D", "Enemy")]
|
||||||
|
script = ExtResource("8_vqdji")
|
||||||
|
AnimatedSprite2D = NodePath("../AnimatedSprite2D")
|
||||||
|
Enemy = NodePath("..")
|
||||||
|
LeftAnimationName = &"Left"
|
||||||
|
RightAnimationName = &"Right"
|
||||||
|
|
||||||
[connection signal="area_entered" from="PlayerDetection" to="PlayerDetection" method="_on_area_entered"]
|
[connection signal="area_entered" from="PlayerDetection" to="PlayerDetection" method="_on_area_entered"]
|
||||||
[connection signal="area_exited" from="PlayerDetection" to="." method="_on_area_exited"]
|
[connection signal="area_exited" from="PlayerDetection" to="." method="_on_area_exited"]
|
||||||
[connection signal="velocity_computed" from="NavigationAgent2D" to="." method="_on_navigation_agent_2d_velocity_computed"]
|
[connection signal="velocity_computed" from="NavigationAgent2D" to="." method="_on_navigation_agent_2d_velocity_computed"]
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,8 @@ public partial class Boss : Enemy, IActivable
|
||||||
|
|
||||||
private BossHud _bossHud;
|
private BossHud _bossHud;
|
||||||
|
|
||||||
|
[Signal] public delegate void ActorSpriteChangeEventHandler(Vector2 direction);
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
base._Ready();
|
base._Ready();
|
||||||
|
|
@ -181,4 +183,9 @@ public partial class Boss : Enemy, IActivable
|
||||||
|
|
||||||
_animationTextureRect.Visible = false;
|
_animationTextureRect.Visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ChangeSpriteDirection(Vector2 direction)
|
||||||
|
{
|
||||||
|
EmitSignal(SignalName.ActorSpriteChange, direction);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -25,7 +25,6 @@ public partial class MovementPattern : AttackPattern
|
||||||
|
|
||||||
Vector2 targetPosition = (Boss?.HomePosition ?? boss.GlobalPosition) + this.relativeTargetPosition;
|
Vector2 targetPosition = (Boss?.HomePosition ?? boss.GlobalPosition) + this.relativeTargetPosition;
|
||||||
|
|
||||||
|
|
||||||
tween.TweenProperty(Boss, "position", targetPosition, moveDuration)
|
tween.TweenProperty(Boss, "position", targetPosition, moveDuration)
|
||||||
.SetTrans(transitionType)
|
.SetTrans(transitionType)
|
||||||
.SetEase(easeType)
|
.SetEase(easeType)
|
||||||
|
|
|
||||||
42
Scripts/Components/Actors/BossSpriteAnimator.cs
Normal file
42
Scripts/Components/Actors/BossSpriteAnimator.cs
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
using Cirno.Scripts.Actors;
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace Cirno.Scripts.Components.Actors;
|
||||||
|
|
||||||
|
public partial class BossSpriteAnimator : Node2D
|
||||||
|
{
|
||||||
|
[Export]
|
||||||
|
public AnimatedSprite2D AnimatedSprite2D { get; private set; }
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public Boss Enemy { get; private set; }
|
||||||
|
|
||||||
|
[Export] public StringName NeutralAnimationName { get; private set; } = "default";
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public StringName LeftAnimationName { get; private set; } = "left";
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public StringName RightAnimationName { get; private set; } = "right";
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
Enemy.ActorSpriteChange += EnemyOnActorSpriteChange;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void EnemyOnActorSpriteChange(Vector2 direction)
|
||||||
|
{
|
||||||
|
if (direction == Vector2.Zero)
|
||||||
|
{
|
||||||
|
AnimatedSprite2D.Play(NeutralAnimationName);
|
||||||
|
}
|
||||||
|
else if (direction.X > 0)
|
||||||
|
{
|
||||||
|
AnimatedSprite2D.Play(RightAnimationName);
|
||||||
|
}
|
||||||
|
else if (direction.X < 0)
|
||||||
|
{
|
||||||
|
AnimatedSprite2D.Play(LeftAnimationName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1
Scripts/Components/Actors/BossSpriteAnimator.cs.uid
Normal file
1
Scripts/Components/Actors/BossSpriteAnimator.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://dtg2vhquyrib3
|
||||||
|
|
@ -22,10 +22,15 @@ public partial class SimpleMovementPattern : AttackPattern
|
||||||
|
|
||||||
Vector2 targetPosition = (Boss?.HomePosition ?? boss.GlobalPosition) + relativeTargetPosition;
|
Vector2 targetPosition = (Boss?.HomePosition ?? boss.GlobalPosition) + relativeTargetPosition;
|
||||||
|
|
||||||
|
boss.ChangeSpriteDirection(-(boss.GlobalPosition - targetPosition));
|
||||||
tween.TweenProperty(Boss, "global_position", targetPosition, moveDuration)
|
tween.TweenProperty(Boss, "global_position", targetPosition, moveDuration)
|
||||||
.SetTrans(transitionType)
|
.SetTrans(transitionType)
|
||||||
.SetEase(easeType)
|
.SetEase(easeType)
|
||||||
.Finished += () => isComplete = true;
|
.Finished += () =>
|
||||||
|
{
|
||||||
|
isComplete = true;
|
||||||
|
boss.ChangeSpriteDirection(Vector2.Zero);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void UpdatePattern(double delta) { }
|
public override void UpdatePattern(double delta) { }
|
||||||
|
|
|
||||||
BIN
Sprites/Actors/Rumia.aseprite
(Stored with Git LFS)
BIN
Sprites/Actors/Rumia.aseprite
(Stored with Git LFS)
Binary file not shown.
BIN
Sprites/Actors/Rumia.png
(Stored with Git LFS)
BIN
Sprites/Actors/Rumia.png
(Stored with Git LFS)
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue