mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 10:15:45 +00:00
Drown animation
This commit is contained in:
parent
be88896252
commit
aa2de85f9a
16 changed files with 264 additions and 14 deletions
|
|
@ -1,6 +1,52 @@
|
|||
[gd_resource type="SpriteFrames" load_steps=15 format=3 uid="uid://bc7mghjx75qip"]
|
||||
[gd_resource type="SpriteFrames" load_steps=28 format=3 uid="uid://bc7mghjx75qip"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://ddwhrlrgj6i00" path="res://Sprites/Actors/Cirno.png" id="1_nsg0m"]
|
||||
[ext_resource type="Texture2D" uid="uid://bvjyivjk530r5" path="res://Sprites/Actors/Cirno_Surprised.png" id="1_smg7h"]
|
||||
[ext_resource type="Texture2D" uid="uid://calorbo7lwx72" path="res://Sprites/Actors/Cirno_Drowning.png" id="2_dod2v"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_qt0xq"]
|
||||
atlas = ExtResource("1_smg7h")
|
||||
region = Rect2(0, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_j8jir"]
|
||||
atlas = ExtResource("1_smg7h")
|
||||
region = Rect2(16, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_6sqmb"]
|
||||
atlas = ExtResource("2_dod2v")
|
||||
region = Rect2(0, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_bl8yu"]
|
||||
atlas = ExtResource("2_dod2v")
|
||||
region = Rect2(16, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_a680j"]
|
||||
atlas = ExtResource("2_dod2v")
|
||||
region = Rect2(32, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_cab7f"]
|
||||
atlas = ExtResource("2_dod2v")
|
||||
region = Rect2(48, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_la2t0"]
|
||||
atlas = ExtResource("2_dod2v")
|
||||
region = Rect2(64, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_eqxxe"]
|
||||
atlas = ExtResource("2_dod2v")
|
||||
region = Rect2(80, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_7j3x3"]
|
||||
atlas = ExtResource("2_dod2v")
|
||||
region = Rect2(96, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_j4qq6"]
|
||||
atlas = ExtResource("2_dod2v")
|
||||
region = Rect2(112, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_34li8"]
|
||||
atlas = ExtResource("2_dod2v")
|
||||
region = Rect2(128, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_6tpxx"]
|
||||
atlas = ExtResource("1_nsg0m")
|
||||
|
|
@ -58,6 +104,62 @@ region = Rect2(32, 16, 16, 16)
|
|||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_qt0xq")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_j8jir")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_qt0xq")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_j8jir")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_qt0xq")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_j8jir")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_6sqmb")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_bl8yu")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_a680j")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_cab7f")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_la2t0")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_eqxxe")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_7j3x3")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_7j3x3")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_j4qq6")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_34li8")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": null
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"Drowning",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_6tpxx")
|
||||
}],
|
||||
"loop": true,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=57 format=3 uid="uid://c4pr2707hbeph"]
|
||||
[gd_scene load_steps=58 format=3 uid="uid://c4pr2707hbeph"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://d2ubk5gucny6s" path="res://Scripts/Components/FSM/PlayerFSMProxy.cs" id="1_g3wua"]
|
||||
[ext_resource type="Script" uid="uid://bw2hakslndaxm" path="res://Scripts/Components/FSM/PlayerStateMachine.cs" id="1_mpmil"]
|
||||
|
|
@ -18,6 +18,7 @@
|
|||
[ext_resource type="PackedScene" uid="uid://biugfbp0yae2s" path="res://Scenes/Particles/DeathParticles.tscn" id="9_0pyos"]
|
||||
[ext_resource type="Script" uid="uid://d208gvthkstvc" path="res://Scripts/Components/Actors/PlayerCrosshairProvider.cs" id="9_s0ir4"]
|
||||
[ext_resource type="Texture2D" uid="uid://cfrvb1moh857m" path="res://Sprites/Crosshair.png" id="10_8dcio"]
|
||||
[ext_resource type="Script" uid="uid://bgve2lktony00" path="res://Scripts/Components/FSM/Player/Drowning.cs" id="10_es1gk"]
|
||||
[ext_resource type="Script" uid="uid://3jxrxcqp3ndr" path="res://Scripts/Components/Actors/PlayerHitboxSpriteProvider.cs" id="10_gp3hw"]
|
||||
[ext_resource type="Texture2D" uid="uid://bwjrdlnysft15" path="res://Sprites/Actors/Focus_Circle.png" id="12_8dcio"]
|
||||
[ext_resource type="Texture2D" uid="uid://bf37ce6jskdel" path="res://Sprites/SmallHitbox.png" id="13_pmkfo"]
|
||||
|
|
@ -274,14 +275,20 @@ _animationProvider = NodePath("../../AnimationProvider")
|
|||
_inputProvider = NodePath("../../InputProvider")
|
||||
_healthProvider = NodePath("../../DamageReceiver/HealthProvider")
|
||||
|
||||
[node name="Drowning" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("_animationProvider")]
|
||||
script = ExtResource("10_es1gk")
|
||||
_animationProvider = NodePath("../../AnimationProvider")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_b3hxm")
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
material = ExtResource("4_5qlss")
|
||||
sprite_frames = ExtResource("4_s0ir4")
|
||||
animation = &"walk_down"
|
||||
frame_progress = 0.50115
|
||||
animation = &"Drowning"
|
||||
autoplay = "idle"
|
||||
frame = 15
|
||||
frame_progress = 0.860925
|
||||
|
||||
[node name="WeaponProvider" type="Node2D" parent="."]
|
||||
script = ExtResource("5_gp3hw")
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=54 format=4 uid="uid://dqyfnby0t7gu1"]
|
||||
[gd_scene load_steps=56 format=4 uid="uid://dqyfnby0t7gu1"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://doxmbokehw8ci" path="res://Scripts/GameManager.cs" id="1_c3v4x"]
|
||||
[ext_resource type="Resource" uid="uid://cs3ihltcn2166" path="res://Resources/Items/IcicleGun.tres" id="3_6314l"]
|
||||
|
|
@ -10,6 +10,7 @@
|
|||
[ext_resource type="PackedScene" uid="uid://c4pr2707hbeph" path="res://Scenes/Actors/fsm_player.tscn" id="8_c3v4x"]
|
||||
[ext_resource type="Material" uid="uid://cdaeormgf78de" path="res://Resources/Materials/Static_Scanlines.tres" id="8_cub4j"]
|
||||
[ext_resource type="Script" uid="uid://cfya7sndh7vy2" path="res://Scenes/CameraController.gd" id="9_dj0ui"]
|
||||
[ext_resource type="Script" uid="uid://crpkvxepkcrir" path="res://Scripts/Components/Actors/ForceFieldCollisionDisabler.cs" id="9_wt88c"]
|
||||
[ext_resource type="PackedScene" uid="uid://cmr6fclttrpkb" path="res://Scenes/Items/Ammo1.tscn" id="10_6314l"]
|
||||
[ext_resource type="PackedScene" uid="uid://d0j1bmgbefyp2" path="res://Scenes/Actors/Lightbridge.tscn" id="10_k6t8d"]
|
||||
[ext_resource type="Script" uid="uid://c5nxsq3tyxcx6" path="res://Scripts/InventoryManager.cs" id="10_qmakk"]
|
||||
|
|
@ -57,6 +58,9 @@ size = Vector2(30, 52.5)
|
|||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_cub4j"]
|
||||
size = Vector2(30, 50.25)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_31m6w"]
|
||||
size = Vector2(30, 53.5)
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_2vu2h"]
|
||||
colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 1)
|
||||
|
||||
|
|
@ -130,6 +134,13 @@ shape = SubResource("RectangleShape2D_rff8l")
|
|||
position = Vector2(413, 106.875)
|
||||
shape = SubResource("RectangleShape2D_cub4j")
|
||||
|
||||
[node name="CollisionShape2D3" type="CollisionShape2D" parent="Tilemaps/AcidHitboxes/Acid" node_paths=PackedStringArray("_door")]
|
||||
position = Vector2(385, 107.75)
|
||||
shape = SubResource("RectangleShape2D_31m6w")
|
||||
script = ExtResource("9_wt88c")
|
||||
_door = NodePath("../../LightBridge2")
|
||||
Invert = true
|
||||
|
||||
[node name="LightBridge" type="Node2D" parent="Tilemaps/AcidHitboxes"]
|
||||
position = Vector2(501.697, 121.54)
|
||||
metadata/_edit_group_ = true
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ ActivationType = 0
|
|||
Targets = Array[NodePath]([NodePath("../Rumia")])
|
||||
WaitForCompletion = true
|
||||
|
||||
[sub_resource type="Resource" id="Resource_bwt6v"]
|
||||
[sub_resource type="Resource" id="Resource_gd7x4"]
|
||||
resource_local_to_scene = true
|
||||
script = ExtResource("49_0si7g")
|
||||
Target = NodePath(".")
|
||||
|
|
@ -798,7 +798,7 @@ Events = Array[ExtResource("42_gd7x4")]([SubResource("Resource_068l7"), SubResou
|
|||
|
||||
[node name="BossBattleStartScript" parent="Factory Tilemaps/LevelProps" instance=ExtResource("43_kf3qc")]
|
||||
position = Vector2(-1487, -396)
|
||||
Events = Array[ExtResource("42_gd7x4")]([SubResource("Resource_4f4id"), SubResource("Resource_s2o7m"), SubResource("Resource_b1dht"), SubResource("Resource_xrgpy"), SubResource("Resource_bwt6v")])
|
||||
Events = Array[ExtResource("42_gd7x4")]([SubResource("Resource_4f4id"), SubResource("Resource_s2o7m"), SubResource("Resource_b1dht"), SubResource("Resource_xrgpy"), SubResource("Resource_gd7x4")])
|
||||
|
||||
[node name="Enemy13" parent="Factory Tilemaps/LevelProps" instance=ExtResource("47_u1ve6")]
|
||||
position = Vector2(-1657, -788)
|
||||
|
|
|
|||
|
|
@ -25,6 +25,9 @@ public partial class PlayerAnimationProvider : Node2D
|
|||
[Export]
|
||||
public StringName WalkUpAnimationName {get; private set;} = "walk_up";
|
||||
|
||||
[Export]
|
||||
public StringName DrowningAnimationName {get; private set;} = "Drowning";
|
||||
|
||||
[ExportCategory("Shaders")]
|
||||
[Export] public ShaderMaterial BlinkMaterial {get; private set;}
|
||||
|
||||
|
|
@ -34,6 +37,13 @@ public partial class PlayerAnimationProvider : Node2D
|
|||
|
||||
private GTween _blinkTween;
|
||||
|
||||
[Signal] public delegate void OnAnimationEndedEventHandler(StringName animationName);
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_animatedSprite.AnimationFinished += () => EmitSignal(SignalName.OnAnimationEnded, _animatedSprite.Animation);
|
||||
}
|
||||
|
||||
public void ShowSprite()
|
||||
{
|
||||
_animatedSprite.Show();
|
||||
|
|
@ -143,6 +153,13 @@ public partial class PlayerAnimationProvider : Node2D
|
|||
_animatedSprite.Visible = false;
|
||||
}
|
||||
|
||||
public void PlayDrowningAnimation()
|
||||
{
|
||||
_animatedSprite.Visible = true;
|
||||
_animatedSprite.Play(DrowningAnimationName);
|
||||
_animatedSprite.SpeedScale = 1;
|
||||
}
|
||||
|
||||
public void PlayShieldAnimation()
|
||||
{
|
||||
_shieldParticles.Emitting = true;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using Cirno.Scripts.Components.FSM;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.Actors;
|
||||
|
|
@ -43,8 +44,12 @@ public partial class PlayerDamageReceiver : Area2D
|
|||
set => _shieldProvider.CurrentResource = value;
|
||||
}
|
||||
|
||||
public void Init()
|
||||
private IStateMachine<PlayerState, CharacterBody2D> _stateMachine;
|
||||
|
||||
public void Init(IStateMachine<PlayerState, CharacterBody2D> machine)
|
||||
{
|
||||
_stateMachine = machine;
|
||||
|
||||
Invulnerable = GlobalState.Instance.SessionSettings.GodMode;
|
||||
|
||||
_healthProvider.ResourceChanged += ((value, maxValue) =>
|
||||
|
|
@ -107,7 +112,8 @@ public partial class PlayerDamageReceiver : Area2D
|
|||
{
|
||||
if (!Enabled) return;
|
||||
GD.Print("Acid death");
|
||||
_healthProvider.CurrentResource = 0;
|
||||
_stateMachine.SetState(PlayerState.Drowning);
|
||||
//_healthProvider.CurrentResource = 0;
|
||||
}
|
||||
|
||||
public void Hit(float damage, DamageType type = DamageType.Neutral)
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ public partial class Active : PlayerStateBase
|
|||
//_hud.UpdateShield(value, maxValue);
|
||||
};
|
||||
|
||||
_damageReceiver.Init();
|
||||
_damageReceiver.Init(StateMachine);
|
||||
|
||||
_damageReceiver.RefillHealth();
|
||||
_damageReceiver.RefillShield();
|
||||
|
|
|
|||
31
Scripts/Components/FSM/Player/Drowning.cs
Normal file
31
Scripts/Components/FSM/Player/Drowning.cs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.FSM.Player;
|
||||
|
||||
public partial class Drowning : PlayerStateBase
|
||||
{
|
||||
public override PlayerState StateId => PlayerState.Drowning;
|
||||
|
||||
[Export]
|
||||
private PlayerAnimationProvider _animationProvider;
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
_animationProvider.PlayDrowningAnimation();
|
||||
|
||||
_animationProvider.OnAnimationEnded += AnimationProviderOnOnAnimationEnded;
|
||||
// Wait for animation over and switch to death
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void AnimationProviderOnOnAnimationEnded(StringName animationName)
|
||||
{
|
||||
if (animationName != _animationProvider.DrowningAnimationName) return;
|
||||
|
||||
_animationProvider.OnAnimationEnded -= AnimationProviderOnOnAnimationEnded;
|
||||
|
||||
StateMachine.SetState(PlayerState.Dead);
|
||||
|
||||
}
|
||||
}
|
||||
1
Scripts/Components/FSM/Player/Drowning.cs.uid
Normal file
1
Scripts/Components/FSM/Player/Drowning.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bgve2lktony00
|
||||
|
|
@ -588,4 +588,5 @@ public enum PlayerState
|
|||
UnTeleporting,
|
||||
Controlling,
|
||||
Dead,
|
||||
Drowning,
|
||||
}
|
||||
BIN
Sprites/Actors/Cirno.aseprite
(Stored with Git LFS)
BIN
Sprites/Actors/Cirno.aseprite
(Stored with Git LFS)
Binary file not shown.
BIN
Sprites/Actors/Cirno_Drowning.png
(Stored with Git LFS)
Normal file
BIN
Sprites/Actors/Cirno_Drowning.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
Sprites/Actors/Cirno_Drowning.png.import
Normal file
34
Sprites/Actors/Cirno_Drowning.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://calorbo7lwx72"
|
||||
path="res://.godot/imported/Cirno_Drowning.png-9637a2b29d8ed3f0e666c2c65c8b8699.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/Actors/Cirno_Drowning.png"
|
||||
dest_files=["res://.godot/imported/Cirno_Drowning.png-9637a2b29d8ed3f0e666c2c65c8b8699.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
|
||||
BIN
Sprites/Actors/Cirno_Surprised.png
(Stored with Git LFS)
Normal file
BIN
Sprites/Actors/Cirno_Surprised.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
Sprites/Actors/Cirno_Surprised.png.import
Normal file
34
Sprites/Actors/Cirno_Surprised.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bvjyivjk530r5"
|
||||
path="res://.godot/imported/Cirno_Surprised.png-cb1fc228a9e5f07a7c2cd5414df6d36f.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/Actors/Cirno_Surprised.png"
|
||||
dest_files=["res://.godot/imported/Cirno_Surprised.png-cb1fc228a9e5f07a7c2cd5414df6d36f.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
|
||||
BIN
Sprites/DoorVertical.aseprite
(Stored with Git LFS)
BIN
Sprites/DoorVertical.aseprite
(Stored with Git LFS)
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue