sprites for doc attack state

pull/3/head
John Montagu, the 4th Earl of Sandvich 2023-07-17 09:30:49 -07:00
parent 97c2b243c7
commit 54c2bef86b
Signed by: sandvich
GPG Key ID: 9A39BE37E602B22D
14 changed files with 418 additions and 17 deletions

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dmeqjcc3uu4xi"
path="res://.godot/imported/shungite.png-b3a7d7db0635944f7318920460aea95b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Sprites/Misc/shungite.png"
dest_files=["res://.godot/imported/shungite.png-b3a7d7db0635944f7318920460aea95b.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

View File

@ -6,6 +6,12 @@ public partial class Doc : Enemy
{ {
[Export] [Export]
public State.NPC.NPCStateMachine BossStateMachine { get; set; } public State.NPC.NPCStateMachine BossStateMachine { get; set; }
public override void _Ready()
{
GD.Print(Health);
base._Ready();
}
public override void _Process(double delta) public override void _Process(double delta)
{ {

View File

@ -12,7 +12,7 @@
[ext_resource type="Script" path="res://State/NPC/Doc/DocAttackState.cs" id="8_r4l3q"] [ext_resource type="Script" path="res://State/NPC/Doc/DocAttackState.cs" id="8_r4l3q"]
[ext_resource type="Script" path="res://Items/Inventory.cs" id="8_r8ejq"] [ext_resource type="Script" path="res://Items/Inventory.cs" id="8_r8ejq"]
[ext_resource type="Script" path="res://State/NPC/Doc/DocExitState.cs" id="9_6com1"] [ext_resource type="Script" path="res://State/NPC/Doc/DocExitState.cs" id="9_6com1"]
[ext_resource type="PackedScene" uid="uid://bqvseo3sbs1aj" path="res://Entities/RailBeam.tscn" id="9_fcrmd"] [ext_resource type="PackedScene" uid="uid://doiwdphocqlpo" path="res://Entities/ShungiteSpike.tscn" id="9_7kavk"]
[ext_resource type="AudioStream" uid="uid://k6kpdj1kv0jg" path="res://Assets/Sounds/splat.ogg" id="9_stm0e"] [ext_resource type="AudioStream" uid="uid://k6kpdj1kv0jg" path="res://Assets/Sounds/splat.ogg" id="9_stm0e"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_7n7iy"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_7n7iy"]
@ -204,7 +204,7 @@ collision_layer = 10
collision_mask = 17 collision_mask = 17
script = ExtResource("2_3elet") script = ExtResource("2_3elet")
BossStateMachine = NodePath("BossStateMachine") BossStateMachine = NodePath("BossStateMachine")
Health = 50.0 Health = 1000.0
Sprite = NodePath("Sprite") Sprite = NodePath("Sprite")
Inventory = NodePath("Inventory") Inventory = NodePath("Inventory")
StateMachine = NodePath("StateMachine") StateMachine = NodePath("StateMachine")
@ -240,7 +240,7 @@ NPC = NodePath("../..")
script = ExtResource("8_r4l3q") script = ExtResource("8_r4l3q")
Duration = 8.0 Duration = 8.0
AttackDuration = 1.0 AttackDuration = 1.0
Projectile = ExtResource("9_fcrmd") Projectile = ExtResource("9_7kavk")
ExitState = NodePath("../Exit") ExitState = NodePath("../Exit")
NPC = NodePath("../..") NPC = NodePath("../..")

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=38 format=3 uid="uid://b2254pup8k161"] [gd_scene load_steps=39 format=3 uid="uid://b2254pup8k161"]
[ext_resource type="Script" path="res://Characters/Player.cs" id="1_flygr"] [ext_resource type="Script" path="res://Characters/Player.cs" id="1_flygr"]
[ext_resource type="Shader" path="res://Shaders/Flash.gdshader" id="2_ngsgt"] [ext_resource type="Shader" path="res://Shaders/Flash.gdshader" id="2_ngsgt"]
@ -14,6 +14,7 @@
[ext_resource type="AudioStream" uid="uid://bkeyg8weaqnuu" path="res://Assets/Sounds/splat-player.ogg" id="12_vvem5"] [ext_resource type="AudioStream" uid="uid://bkeyg8weaqnuu" path="res://Assets/Sounds/splat-player.ogg" id="12_vvem5"]
[ext_resource type="Script" path="res://BoundingBoxes/InteractionRay.cs" id="13_hs3u1"] [ext_resource type="Script" path="res://BoundingBoxes/InteractionRay.cs" id="13_hs3u1"]
[ext_resource type="Texture2D" uid="uid://coarr28adgo1u" path="res://Assets/Sprites/Particles/point-light.png" id="14_l4ekh"] [ext_resource type="Texture2D" uid="uid://coarr28adgo1u" path="res://Assets/Sprites/Particles/point-light.png" id="14_l4ekh"]
[ext_resource type="Script" path="res://Utils/DamageTime.cs" id="15_4xl06"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_h78y7"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_h78y7"]
shader = ExtResource("2_ngsgt") shader = ExtResource("2_ngsgt")
@ -328,4 +329,7 @@ shadow_filter_smooth = 3.0
texture = ExtResource("14_l4ekh") texture = ExtResource("14_l4ekh")
texture_scale = 0.5 texture_scale = 0.5
[node name="DamageTime" type="Node" parent="."]
script = ExtResource("15_4xl06")
[editable path="Hurtbox"] [editable path="Hurtbox"]

View File

@ -44,11 +44,8 @@ public partial class Projectile : RigidBody2D
public override void _PhysicsProcess(double delta) public override void _PhysicsProcess(double delta)
{ {
if (Delay <= 0) Vector2 velocity = Delay <= 0 ? Velocity : Vector2.Zero;
{ MoveAndCollide(velocity * (float)delta);
Vector2 velocity = Velocity;
MoveAndCollide(velocity * (float)delta);
}
} }
public void OnHit(BoundingBox box) public void OnHit(BoundingBox box)

View File

@ -0,0 +1,13 @@
using Godot;
namespace SupaLidlGame.Entities;
public partial class ShungiteSpike : Projectile
{
public override void _Ready()
{
var player = GetNode<AnimationPlayer>("AnimationPlayer");
player.Play("spin");
player.SpeedScale = (float)(1 / Delay);
base._Ready();
}
}

View File

@ -0,0 +1,307 @@
[gd_scene load_steps=42 format=3 uid="uid://doiwdphocqlpo"]
[ext_resource type="Script" path="res://Entities/ShungiteSpike.cs" id="1_pclpe"]
[ext_resource type="Texture2D" uid="uid://dmeqjcc3uu4xi" path="res://Assets/Sprites/Misc/shungite.png" id="2_gyvna"]
[ext_resource type="PackedScene" uid="uid://du5vhccg75nrq" path="res://BoundingBoxes/Hitbox.tscn" id="3_kojrj"]
[ext_resource type="Script" path="res://Utils/ProjectileTweeners/DelaySpin.cs" id="4_wy5kh"]
[sub_resource type="AtlasTexture" id="AtlasTexture_xmjp8"]
atlas = ExtResource("2_gyvna")
region = Rect2(0, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_8i61s"]
atlas = ExtResource("2_gyvna")
region = Rect2(8, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_q000r"]
atlas = ExtResource("2_gyvna")
region = Rect2(16, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_0f7fg"]
atlas = ExtResource("2_gyvna")
region = Rect2(24, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_d34ii"]
atlas = ExtResource("2_gyvna")
region = Rect2(32, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_iybvf"]
atlas = ExtResource("2_gyvna")
region = Rect2(40, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_rninu"]
atlas = ExtResource("2_gyvna")
region = Rect2(48, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_8vok2"]
atlas = ExtResource("2_gyvna")
region = Rect2(56, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_7tcc7"]
atlas = ExtResource("2_gyvna")
region = Rect2(64, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_sfa0w"]
atlas = ExtResource("2_gyvna")
region = Rect2(72, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_21chc"]
atlas = ExtResource("2_gyvna")
region = Rect2(80, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_iroma"]
atlas = ExtResource("2_gyvna")
region = Rect2(88, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_hbl5e"]
atlas = ExtResource("2_gyvna")
region = Rect2(96, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_qlpso"]
atlas = ExtResource("2_gyvna")
region = Rect2(104, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_v65pa"]
atlas = ExtResource("2_gyvna")
region = Rect2(112, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_jotwh"]
atlas = ExtResource("2_gyvna")
region = Rect2(120, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_lu113"]
atlas = ExtResource("2_gyvna")
region = Rect2(128, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_w332l"]
atlas = ExtResource("2_gyvna")
region = Rect2(136, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_mg73k"]
atlas = ExtResource("2_gyvna")
region = Rect2(144, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_m0ogr"]
atlas = ExtResource("2_gyvna")
region = Rect2(152, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_py1jk"]
atlas = ExtResource("2_gyvna")
region = Rect2(160, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_0a8wd"]
atlas = ExtResource("2_gyvna")
region = Rect2(168, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_8ut6e"]
atlas = ExtResource("2_gyvna")
region = Rect2(176, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_x5ucf"]
atlas = ExtResource("2_gyvna")
region = Rect2(184, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_13nfm"]
atlas = ExtResource("2_gyvna")
region = Rect2(192, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_uhjdb"]
atlas = ExtResource("2_gyvna")
region = Rect2(200, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_4vrn8"]
atlas = ExtResource("2_gyvna")
region = Rect2(208, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_4aa2t"]
atlas = ExtResource("2_gyvna")
region = Rect2(216, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_tn6f5"]
atlas = ExtResource("2_gyvna")
region = Rect2(224, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_60mwy"]
atlas = ExtResource("2_gyvna")
region = Rect2(232, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_d0xqb"]
atlas = ExtResource("2_gyvna")
region = Rect2(240, 0, 8, 8)
[sub_resource type="AtlasTexture" id="AtlasTexture_j2hu2"]
atlas = ExtResource("2_gyvna")
region = Rect2(248, 0, 8, 8)
[sub_resource type="SpriteFrames" id="SpriteFrames_6a2jq"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_xmjp8")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_8i61s")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_q000r")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_0f7fg")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_d34ii")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_iybvf")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_rninu")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_8vok2")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_7tcc7")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_sfa0w")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_21chc")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_iroma")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_hbl5e")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_qlpso")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_v65pa")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_jotwh")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_lu113")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_w332l")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_mg73k")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_m0ogr")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_py1jk")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_0a8wd")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_8ut6e")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_x5ucf")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_13nfm")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_uhjdb")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_4vrn8")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_4aa2t")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_tn6f5")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_60mwy")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_d0xqb")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_j2hu2")
}],
"loop": true,
"name": &"default",
"speed": 5.0
}]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_fa7yf"]
size = Vector2(8, 4)
[sub_resource type="Animation" id="Animation_tgj7f"]
resource_name = "spin"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:rotation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.5),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [-4.71239, 1.5708]
}
[sub_resource type="Animation" id="Animation_tcdo0"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:rotation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [1.5708]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_pehte"]
_data = {
"RESET": SubResource("Animation_tcdo0"),
"spin": SubResource("Animation_tgj7f")
}
[node name="ShungiteSpike" type="RigidBody2D" node_paths=PackedStringArray("Hitbox")]
script = ExtResource("1_pclpe")
Speed = 256.0
Hitbox = NodePath("Hitbox")
Delay = 1.0
[node name="Sprite2D" type="AnimatedSprite2D" parent="."]
texture_filter = 1
rotation = 1.5708
sprite_frames = SubResource("SpriteFrames_6a2jq")
frame_progress = 0.227702
speed_scale = 4.0
[node name="Hitbox" parent="." instance=ExtResource("3_kojrj")]
Damage = 25.0
Knockback = 128.0
[node name="CollisionShape2D" parent="Hitbox" index="0"]
shape = SubResource("RectangleShape2D_fa7yf")
[node name="DelaySpinTweener" type="Node" parent="."]
script = ExtResource("4_wy5kh")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_pehte")
}
[editable path="Hitbox"]

View File

@ -252,7 +252,7 @@ physics_layer_0/collision_layer = 1
sources/2 = SubResource("TileSetAtlasSource_5yxvt") sources/2 = SubResource("TileSetAtlasSource_5yxvt")
sources/0 = SubResource("TileSetAtlasSource_fcd6d") sources/0 = SubResource("TileSetAtlasSource_fcd6d")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_wurwd"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_hn0x7"]
resource_local_to_scene = true resource_local_to_scene = true
shader = ExtResource("5_aevwf") shader = ExtResource("5_aevwf")
shader_parameter/color = Quaternion(1, 1, 1, 1) shader_parameter/color = Quaternion(1, 1, 1, 1)
@ -268,7 +268,6 @@ layer_4/tile_data = PackedInt32Array(-524296, 327680, 0, -589818, 262144, 0, -58
color = Color(0.753984, 0.753984, 0.753984, 1) color = Color(0.753984, 0.753984, 0.753984, 1)
[node name="Doc" parent="Entities" index="0" instance=ExtResource("4_c0csw")] [node name="Doc" parent="Entities" index="0" instance=ExtResource("4_c0csw")]
material = SubResource("ShaderMaterial_wurwd") material = SubResource("ShaderMaterial_hn0x7")
PreferredWeightDistance = 256.0 PreferredWeightDistance = 256.0
MaxWeightDistance = 32.0 MaxWeightDistance = 32.0
Health = 1000.0

View File

@ -5,11 +5,11 @@ namespace SupaLidlGame.State.NPC.Doc;
public partial class DocAttackState : NPCState public partial class DocAttackState : NPCState
{ {
private Scenes.Map _map; protected Scenes.Map _map;
private Utils.World _world; protected Utils.World _world;
private double _currentDuration = 0; protected double _currentDuration = 0;
private double _currentAttackDuration = 0; protected double _currentAttackDuration = 0;
[Export] [Export]
public double Duration { get; set; } public double Duration { get; set; }
@ -39,7 +39,7 @@ public partial class DocAttackState : NPCState
} }
private void SpawnProjectile(Vector2 position, Vector2 direction) protected virtual void SpawnProjectile(Vector2 position, Vector2 direction)
{ {
var projectile = _map.SpawnEntity<Entities.Projectile>(Projectile); var projectile = _map.SpawnEntity<Entities.Projectile>(Projectile);
projectile.Hitbox.Faction = NPC.Faction; projectile.Hitbox.Faction = NPC.Faction;

View File

@ -0,0 +1,41 @@
using Godot;
namespace SupaLidlGame.Utils;
public partial class DamageTime : Node
{
private double _duration = 0.1;
private double _currentDuration = 0;
private double _startValue = 0;
public override void _Ready()
{
if (GetParent() is Characters.Player player)
{
player.Hurt += PlayerHurt;
}
}
private void PlayerHurt(Events.HealthChangedArgs args)
{
if (args.Damage > 10)
{
// temp
//float strength = 0.8f;
//_startValue = 1 - strength;
//_currentDuration = 0;
_currentDuration = _duration;
Engine.TimeScale = 0.1;
}
}
public override void _Process(double delta)
{
if ((_currentDuration -= delta) < 0)
{
Engine.TimeScale = 1;
}
}
}