diff --git a/Assets/Sounds/splat-player.ogg b/Assets/Sounds/splat-player.ogg new file mode 100644 index 0000000..9dfeb19 Binary files /dev/null and b/Assets/Sounds/splat-player.ogg differ diff --git a/Assets/Sounds/splat-player.ogg.import b/Assets/Sounds/splat-player.ogg.import new file mode 100644 index 0000000..4207ee0 --- /dev/null +++ b/Assets/Sounds/splat-player.ogg.import @@ -0,0 +1,19 @@ +[remap] + +importer="oggvorbisstr" +type="AudioStreamOggVorbis" +uid="uid://bkeyg8weaqnuu" +path="res://.godot/imported/splat-player.ogg-b9195de7bb7ca34678fd41a9159d6c3d.oggvorbisstr" + +[deps] + +source_file="res://Assets/Sounds/splat-player.ogg" +dest_files=["res://.godot/imported/splat-player.ogg-b9195de7bb7ca34678fd41a9159d6c3d.oggvorbisstr"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/Assets/Sounds/splat.ogg b/Assets/Sounds/splat.ogg new file mode 100644 index 0000000..c981436 Binary files /dev/null and b/Assets/Sounds/splat.ogg differ diff --git a/Assets/Sounds/splat.ogg.import b/Assets/Sounds/splat.ogg.import new file mode 100644 index 0000000..7d694e9 --- /dev/null +++ b/Assets/Sounds/splat.ogg.import @@ -0,0 +1,19 @@ +[remap] + +importer="oggvorbisstr" +type="AudioStreamOggVorbis" +uid="uid://k6kpdj1kv0jg" +path="res://.godot/imported/splat.ogg-3afac4e48ba675494c2bad9f16c4bde8.oggvorbisstr" + +[deps] + +source_file="res://Assets/Sounds/splat.ogg" +dest_files=["res://.godot/imported/splat.ogg-3afac4e48ba675494c2bad9f16c4bde8.oggvorbisstr"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/Assets/Sprites/Characters/doc.ase b/Assets/Sprites/Characters/doc.ase index cbcf4a5..2fd3a93 100644 Binary files a/Assets/Sprites/Characters/doc.ase and b/Assets/Sprites/Characters/doc.ase differ diff --git a/Assets/Sprites/Characters/doc.png b/Assets/Sprites/Characters/doc.png new file mode 100644 index 0000000..cd4c281 Binary files /dev/null and b/Assets/Sprites/Characters/doc.png differ diff --git a/Assets/Sprites/Characters/doc.png.import b/Assets/Sprites/Characters/doc.png.import new file mode 100644 index 0000000..170a85c --- /dev/null +++ b/Assets/Sprites/Characters/doc.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://baiuqgrqipppt" +path="res://.godot/imported/doc.png-044b4c8c4ee17602696518fdf8def758.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Sprites/Characters/doc.png" +dest_files=["res://.godot/imported/doc.png-044b4c8c4ee17602696518fdf8def758.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 diff --git a/Assets/Sprites/arena-tileset-normal.png b/Assets/Sprites/arena-tileset-normal.png new file mode 100644 index 0000000..2082f9e Binary files /dev/null and b/Assets/Sprites/arena-tileset-normal.png differ diff --git a/Assets/Sprites/arena-tileset-normal.png.import b/Assets/Sprites/arena-tileset-normal.png.import new file mode 100644 index 0000000..64e9064 --- /dev/null +++ b/Assets/Sprites/arena-tileset-normal.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://5k0o7d7j65a4" +path="res://.godot/imported/arena-tileset-normal.png-9466546ce6c631f7ed3196f7d2a888b3.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Sprites/arena-tileset-normal.png" +dest_files=["res://.godot/imported/arena-tileset-normal.png-9466546ce6c631f7ed3196f7d2a888b3.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 diff --git a/Assets/Sprites/arena-tileset.ase b/Assets/Sprites/arena-tileset.ase new file mode 100644 index 0000000..7a34fb5 Binary files /dev/null and b/Assets/Sprites/arena-tileset.ase differ diff --git a/Assets/Sprites/arena-tileset.png b/Assets/Sprites/arena-tileset.png new file mode 100644 index 0000000..37205f5 Binary files /dev/null and b/Assets/Sprites/arena-tileset.png differ diff --git a/Assets/Sprites/arena-tileset.png.import b/Assets/Sprites/arena-tileset.png.import new file mode 100644 index 0000000..d6c9bc5 --- /dev/null +++ b/Assets/Sprites/arena-tileset.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b0yiy7w8nxmas" +path="res://.godot/imported/arena-tileset.png-a3c9cd5d13a16cc6a35727d6d51ff6f7.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Sprites/arena-tileset.png" +dest_files=["res://.godot/imported/arena-tileset.png-a3c9cd5d13a16cc6a35727d6d51ff6f7.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 diff --git a/BoundingBoxes/Hurtbox.cs b/BoundingBoxes/Hurtbox.cs index f9e6c4f..ca36c51 100644 --- a/BoundingBoxes/Hurtbox.cs +++ b/BoundingBoxes/Hurtbox.cs @@ -29,14 +29,11 @@ public partial class Hurtbox : BoundingBox, IFaction Vector2 knockbackOrigin = default, Vector2 knockbackVector = default) { - if (inflictor is not null) - { - EmitSignal( - SignalName.ReceivedDamage, - damage, - inflictor, - knockback, - knockbackOrigin, knockbackVector); - } + EmitSignal( + SignalName.ReceivedDamage, + damage, + inflictor, + knockback, + knockbackOrigin, knockbackVector); } } diff --git a/Characters/Character.cs b/Characters/Character.cs index 12f58e7..e986353 100644 --- a/Characters/Character.cs +++ b/Characters/Character.cs @@ -202,7 +202,14 @@ public partial class Character : CharacterBody2D, IFaction { if (knockbackOrigin == default) { - knockbackOrigin = inflictor.GlobalPosition; + if (inflictor is null) + { + knockbackOrigin = GlobalPosition + Vector2.Down; + } + else + { + knockbackOrigin = inflictor.GlobalPosition; + } } knockbackDir = knockbackOrigin.DirectionTo(GlobalPosition); diff --git a/Characters/Doc.cs b/Characters/Doc.cs new file mode 100644 index 0000000..6accedc --- /dev/null +++ b/Characters/Doc.cs @@ -0,0 +1,15 @@ +using Godot; + +namespace SupaLidlGame.Characters; + +public partial class Doc : Enemy +{ + [Export] + public State.NPC.NPCStateMachine BossStateMachine { get; set; } + + public override void _Process(double delta) + { + BossStateMachine.Process(delta); + base._Process(delta); + } +} diff --git a/Characters/Doc.tscn b/Characters/Doc.tscn new file mode 100644 index 0000000..5378697 --- /dev/null +++ b/Characters/Doc.tscn @@ -0,0 +1,296 @@ +[gd_scene load_steps=33 format=3 uid="uid://bt6s40u515jvo"] + +[ext_resource type="Script" path="res://Characters/Doc.cs" id="2_3elet"] +[ext_resource type="Shader" path="res://Shaders/Flash.gdshader" id="2_5jxom"] +[ext_resource type="Texture2D" uid="uid://baiuqgrqipppt" path="res://Assets/Sprites/Characters/doc.png" id="3_rs44f"] +[ext_resource type="Script" path="res://State/Character/CharacterStateMachine.cs" id="3_t5jjc"] +[ext_resource type="Script" path="res://State/Character/NPCIdleState.cs" id="4_b35px"] +[ext_resource type="Script" path="res://State/Character/NPCMoveState.cs" id="5_pejsd"] +[ext_resource type="Script" path="res://State/NPC/NPCStateMachine.cs" id="6_kjpug"] +[ext_resource type="Script" path="res://State/NPC/Doc/DocTelegraphState.cs" id="7_tfwbh"] +[ext_resource type="PackedScene" uid="uid://cjgxyhgcyvsv7" path="res://BoundingBoxes/Hurtbox.tscn" id="7_tnve0"] +[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://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="AudioStream" uid="uid://k6kpdj1kv0jg" path="res://Assets/Sounds/splat.ogg" id="9_stm0e"] + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_7n7iy"] +resource_local_to_scene = true +shader = ExtResource("2_5jxom") +shader_parameter/color = Quaternion(1, 1, 1, 1) +shader_parameter/intensity = 0.0 + +[sub_resource type="Animation" id="Animation_7oukw"] +resource_name = "enter_in" +length = 0.5 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("../Sprite:scale") +tracks/0/interp = 2 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.4), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Vector2(2, 0.5), Vector2(1, 1)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("../Sprite:modulate") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0, 0.5), +"transitions": PackedFloat32Array(2, 1), +"update": 0, +"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 0.5)] +} + +[sub_resource type="Animation" id="Animation_j3s0y"] +resource_name = "exit_out" +length = 0.5 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("../Sprite:scale") +tracks/0/interp = 2 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.4), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Vector2(1, 1), Vector2(2, 0.5)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("../Sprite:modulate") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0, 0.5), +"transitions": PackedFloat32Array(1, 2), +"update": 0, +"values": [Color(1, 1, 1, 0.5), Color(1, 1, 1, 0)] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_rpply"] +_data = { +"enter_in": SubResource("Animation_7oukw"), +"exit_out": SubResource("Animation_j3s0y") +} + +[sub_resource type="AtlasTexture" id="AtlasTexture_dib6t"] +atlas = ExtResource("3_rs44f") +region = Rect2(0, 0, 12, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_cwqre"] +atlas = ExtResource("3_rs44f") +region = Rect2(12, 0, 12, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_r8xjl"] +atlas = ExtResource("3_rs44f") +region = Rect2(24, 0, 12, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_7hkj4"] +atlas = ExtResource("3_rs44f") +region = Rect2(36, 0, 12, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_w04w0"] +atlas = ExtResource("3_rs44f") +region = Rect2(48, 0, 12, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ym6tg"] +atlas = ExtResource("3_rs44f") +region = Rect2(60, 0, 12, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_3rbas"] +atlas = ExtResource("3_rs44f") +region = Rect2(72, 0, 12, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_63wkp"] +atlas = ExtResource("3_rs44f") +region = Rect2(84, 0, 12, 16) + +[sub_resource type="SpriteFrames" id="SpriteFrames_kb0pl"] +resource_local_to_scene = true +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_dib6t") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_cwqre") +}], +"loop": true, +"name": &"idle", +"speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_r8xjl") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_7hkj4") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_w04w0") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ym6tg") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_3rbas") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_63wkp") +}], +"loop": true, +"name": &"move", +"speed": 12.0 +}] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_uict5"] +size = Vector2(16, 8) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_8lxmf"] +size = Vector2(16, 18) + +[sub_resource type="Animation" id="Animation_dxevc"] +resource_name = "Hurt" +length = 0.6 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:material:shader_parameter/intensity") +tracks/0/interp = 2 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6), +"transitions": PackedFloat32Array(4, 4, 4, 4, 4, 4, 4), +"update": 0, +"values": [0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0] +} + +[sub_resource type="Animation" id="Animation_k6l16"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:material:shader_parameter/intensity") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [0.0] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_xe5eq"] +_data = { +"Hurt": SubResource("Animation_dxevc"), +"RESET": SubResource("Animation_k6l16") +} + +[node name="Doc" type="CharacterBody2D" node_paths=PackedStringArray("BossStateMachine", "Sprite", "Inventory", "StateMachine", "Hurtbox")] +y_sort_enabled = true +texture_filter = 3 +material = SubResource("ShaderMaterial_7n7iy") +collision_layer = 10 +collision_mask = 17 +script = ExtResource("2_3elet") +BossStateMachine = NodePath("BossStateMachine") +Health = 50.0 +Sprite = NodePath("Sprite") +Inventory = NodePath("Inventory") +StateMachine = NodePath("StateMachine") +Hurtbox = NodePath("Hurtbox") +Faction = 2 + +[node name="StateMachine" type="Node" parent="." node_paths=PackedStringArray("InitialState", "Character")] +script = ExtResource("3_t5jjc") +InitialState = NodePath("Idle") +Character = NodePath("..") + +[node name="Idle" type="Node" parent="StateMachine" node_paths=PackedStringArray("MoveState", "Character")] +script = ExtResource("4_b35px") +MoveState = NodePath("../Move") +Character = NodePath("../..") + +[node name="Move" type="Node" parent="StateMachine" node_paths=PackedStringArray("IdleState", "Character")] +script = ExtResource("5_pejsd") +IdleState = NodePath("../Idle") +Character = NodePath("../..") + +[node name="BossStateMachine" type="Node" parent="." node_paths=PackedStringArray("InitialState")] +script = ExtResource("6_kjpug") +InitialState = NodePath("Telegraph") + +[node name="Telegraph" type="Node" parent="BossStateMachine" node_paths=PackedStringArray("TelegraphAnimationPlayer", "AttackState", "NPC")] +script = ExtResource("7_tfwbh") +TelegraphAnimationPlayer = NodePath("../../Animations/Telegraph") +AttackState = NodePath("../Attack") +NPC = NodePath("../..") + +[node name="Attack" type="Node" parent="BossStateMachine" node_paths=PackedStringArray("ExitState", "NPC")] +script = ExtResource("8_r4l3q") +Duration = 8.0 +AttackDuration = 1.0 +Projectile = ExtResource("9_fcrmd") +ExitState = NodePath("../Exit") +NPC = NodePath("../..") + +[node name="Exit" type="Node" parent="BossStateMachine" node_paths=PackedStringArray("TelegraphAnimationPlayer", "TelegraphState", "NPC")] +script = ExtResource("9_6com1") +TelegraphAnimationPlayer = NodePath("../../Animations/Telegraph") +TelegraphState = NodePath("../Telegraph") +NPC = NodePath("../..") + +[node name="Animations" type="Node" parent="."] + +[node name="Telegraph" type="AnimationPlayer" parent="Animations"] +libraries = { +"": SubResource("AnimationLibrary_rpply") +} + +[node name="Sprite" type="AnimatedSprite2D" parent="."] +modulate = Color(1, 1, 1, 0.5) +use_parent_material = true +position = Vector2(0, -4) +sprite_frames = SubResource("SpriteFrames_kb0pl") +animation = &"move" +frame_progress = 0.563144 +offset = Vector2(0, 4) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +visible = false +position = Vector2(0, 4) +shape = SubResource("RectangleShape2D_uict5") + +[node name="Hurtbox" parent="." instance=ExtResource("7_tnve0")] +visible = false +position = Vector2(0, -4) +Faction = 2 + +[node name="CollisionShape2D" parent="Hurtbox" index="0"] +position = Vector2(0, 4) +shape = SubResource("RectangleShape2D_8lxmf") + +[node name="Inventory" type="Node2D" parent="."] +y_sort_enabled = true +script = ExtResource("8_r8ejq") +Items = Array[Node2D]([]) + +[node name="FlashAnimation" type="AnimationPlayer" parent="."] +libraries = { +"": SubResource("AnimationLibrary_xe5eq") +} + +[node name="HurtSound" type="AudioStreamPlayer2D" parent="."] +stream = ExtResource("9_stm0e") + +[editable path="Hurtbox"] diff --git a/Characters/Enemy.cs b/Characters/Enemy.cs index 4d5b335..a508679 100644 --- a/Characters/Enemy.cs +++ b/Characters/Enemy.cs @@ -5,12 +5,6 @@ namespace SupaLidlGame.Characters; public partial class Enemy : NPC { - public override void _Ready() - { - Inventory.SelectedItem = Inventory.GetNode("Sword"); - base._Ready(); - } - public override void Die() { base.Die(); diff --git a/Characters/Player.tscn b/Characters/Player.tscn index b18c399..f54a756 100644 --- a/Characters/Player.tscn +++ b/Characters/Player.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=37 format=3 uid="uid://b2254pup8k161"] +[gd_scene load_steps=38 format=3 uid="uid://b2254pup8k161"] [ext_resource type="Script" path="res://Characters/Player.cs" id="1_flygr"] [ext_resource type="Shader" path="res://Shaders/Flash.gdshader" id="2_ngsgt"] @@ -11,8 +11,9 @@ [ext_resource type="Script" path="res://Items/Inventory.cs" id="7_xyenu"] [ext_resource type="Script" path="res://State/Character/PlayerRollState.cs" id="8_fy0v5"] [ext_resource type="PackedScene" uid="uid://cjgxyhgcyvsv7" path="res://BoundingBoxes/Hurtbox.tscn" id="9_avyu4"] -[ext_resource type="AudioStream" uid="uid://njun3e6v4854" path="res://Assets/Sounds/hurt.wav" id="12_h0x0g"] +[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="Texture2D" uid="uid://coarr28adgo1u" path="res://Assets/Sprites/Particles/point-light.png" id="14_l4ekh"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_h78y7"] shader = ExtResource("2_ngsgt") @@ -89,7 +90,7 @@ animations = [{ }] [sub_resource type="RectangleShape2D" id="RectangleShape2D_bfqew"] -size = Vector2(16, 8) +size = Vector2(12, 8) [sub_resource type="LabelSettings" id="LabelSettings_q5h1n"] font_size = 24 @@ -134,6 +135,21 @@ _data = { "RESET": SubResource("Animation_k6l16") } +[sub_resource type="Animation" id="Animation_yejx2"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Sprite:rotation") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [0.0] +} + [sub_resource type="Animation" id="Animation_rx2pj"] resource_name = "roll" length = 0.5 @@ -151,21 +167,6 @@ tracks/0/keys = { "values": [0.0, 3.14159, 6.28319] } -[sub_resource type="Animation" id="Animation_yejx2"] -length = 0.001 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("Sprite:rotation") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 0, -"values": [0.0] -} - [sub_resource type="AnimationLibrary" id="AnimationLibrary_jai06"] _data = { "RESET": SubResource("Animation_yejx2"), @@ -266,11 +267,9 @@ horizontal_alignment = 1 [node name="Node" type="Node" parent="."] -[node name="Inventory" type="Node2D" parent="." node_paths=PackedStringArray("Items")] -y_sort_enabled = true +[node name="Inventory" type="Node2D" parent="."] position = Vector2(0, 4) script = ExtResource("7_xyenu") -Items = [] InventoryMap = { "equip_1": 0, "equip_2": 1 @@ -298,7 +297,7 @@ libraries = { } [node name="HurtSound" type="AudioStreamPlayer2D" parent="."] -stream = ExtResource("12_h0x0g") +stream = ExtResource("12_vvem5") max_distance = 64.0 [node name="AudioListener2D" type="AudioListener2D" parent="."] @@ -321,4 +320,12 @@ texture = SubResource("CanvasTexture_pited") one_shot = true explosiveness = 0.9 +[node name="PointLight2D" type="PointLight2D" parent="."] +blend_mode = 2 +shadow_enabled = true +shadow_filter = 2 +shadow_filter_smooth = 3.0 +texture = ExtResource("14_l4ekh") +texture_scale = 0.5 + [editable path="Hurtbox"] diff --git a/Entities/Projectile.cs b/Entities/Projectile.cs index 06c1f71..731fbfa 100644 --- a/Entities/Projectile.cs +++ b/Entities/Projectile.cs @@ -20,10 +20,22 @@ public partial class Projectile : RigidBody2D [Export] public double Lifetime { get; set; } = 10; + [Export] + public double Delay { get; set; } = 0; + public Character Character { get; set; } + public override void _Ready() + { + Hitbox.Hit += OnHit; + } + public override void _Process(double delta) { + if (Delay > 0) + { + Delay -= delta; + } if ((Lifetime -= delta) <= 0) { QueueFree(); @@ -32,11 +44,14 @@ public partial class Projectile : RigidBody2D public override void _PhysicsProcess(double delta) { - Vector2 velocity = Velocity; - MoveAndCollide(velocity * (float)delta); + if (Delay <= 0) + { + Vector2 velocity = Velocity; + MoveAndCollide(velocity * (float)delta); + } } - public void _on_hitbox_hit(BoundingBox box) + public void OnHit(BoundingBox box) { if (box is Hurtbox hurtbox) { diff --git a/Entities/RailBeam.tscn b/Entities/RailBeam.tscn index 1a41828..49eeafb 100644 --- a/Entities/RailBeam.tscn +++ b/Entities/RailBeam.tscn @@ -27,6 +27,4 @@ Knockback = 256.0 [node name="CollisionShape2D" parent="Hitbox" index="0"] shape = SubResource("RectangleShape2D_j0tne") -[connection signal="Hit" from="Hitbox" to="." method="_on_hitbox_hit"] - [editable path="Hitbox"] diff --git a/Items/Weapons/Sword.tscn b/Items/Weapons/Sword.tscn index b200c38..69f13b2 100644 --- a/Items/Weapons/Sword.tscn +++ b/Items/Weapons/Sword.tscn @@ -340,13 +340,13 @@ Hitbox = NodePath("Hitbox") AnimationPlayer = NodePath("AnimationPlayer") AnimationTree = NodePath("AnimationTree") AttackTime = 0.2 -AttackAnimationDuration = 1.0 +AttackAnimationDuration = 0.75 ParryParticles = NodePath("Anchor/Node2D/Sprite2D/ParryParticles") NPCAnticipateTime = 0.3 StateMachine = NodePath("State") Anchor = NodePath("Anchor") Damage = 20.0 -UseTime = 0.8 +UseTime = 0.55 Knockback = 64.0 ShouldHideIdle = true diff --git a/Scenes/Level.tscn b/Scenes/Level.tscn index efb08ee..910e672 100644 --- a/Scenes/Level.tscn +++ b/Scenes/Level.tscn @@ -1,8 +1,8 @@ [gd_scene load_steps=3 format=3 uid="uid://1pb3mpmrl7lc"] [ext_resource type="Script" path="res://Utils/World.cs" id="1_1k6ew"] -[ext_resource type="PackedScene" uid="uid://bxtpv6jqodj4v" path="res://Scenes/Maps/Hills.tscn" id="2_juio7"] +[ext_resource type="PackedScene" uid="uid://b2x17su05ou5w" path="res://Scenes/Maps/Arena.tscn" id="2_avsrq"] [node name="World" type="Node2D"] script = ExtResource("1_1k6ew") -StartingArea = ExtResource("2_juio7") +StartingArea = ExtResource("2_avsrq") diff --git a/Scenes/Map.cs b/Scenes/Map.cs index f64f2eb..3432ec2 100644 --- a/Scenes/Map.cs +++ b/Scenes/Map.cs @@ -29,7 +29,7 @@ public partial class Map : TileMap } set { - _active = Visible = value; + _active = Visible = value; SetProcess(value); } } @@ -43,4 +43,16 @@ public partial class Map : TileMap { base._Process(delta); } + + public Node SpawnEntity(PackedScene scene) + { + var instance = scene.Instantiate(); + Entities.AddChild(instance); + return instance; + } + + public T SpawnEntity(PackedScene scene) where T : Node + { + return SpawnEntity(scene) as T; + } } diff --git a/Scenes/Maps/Arena.tscn b/Scenes/Maps/Arena.tscn new file mode 100644 index 0000000..d7b6104 --- /dev/null +++ b/Scenes/Maps/Arena.tscn @@ -0,0 +1,274 @@ +[gd_scene load_steps=13 format=3 uid="uid://b2x17su05ou5w"] + +[ext_resource type="PackedScene" uid="uid://clwv2owvk6abe" path="res://Scenes/BaseMap.tscn" id="1_ifiic"] +[ext_resource type="Texture2D" uid="uid://b0yiy7w8nxmas" path="res://Assets/Sprites/arena-tileset.png" id="2_wnjm0"] +[ext_resource type="Texture2D" uid="uid://5k0o7d7j65a4" path="res://Assets/Sprites/arena-tileset-normal.png" id="3_iitgk"] +[ext_resource type="PackedScene" uid="uid://bt6s40u515jvo" path="res://Characters/Doc.tscn" id="4_c0csw"] +[ext_resource type="Shader" path="res://Shaders/Flash.gdshader" id="5_aevwf"] + +[sub_resource type="OccluderPolygon2D" id="OccluderPolygon2D_8jil2"] +polygon = PackedVector2Array(-8, -4, -6, -5, -6, -18, 6, -18, 6, -5, 8, -4, 8, 4, 4, 8, -4, 8, -8, 3.5) + +[sub_resource type="CanvasTexture" id="CanvasTexture_dnsyd"] +diffuse_texture = ExtResource("2_wnjm0") +normal_texture = ExtResource("3_iitgk") + +[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_fcd6d"] +texture = SubResource("CanvasTexture_dnsyd") +0:0/0 = 0 +0:0/0/physics_layer_0/linear_velocity = Vector2(0, 0) +0:0/0/physics_layer_0/angular_velocity = 0.0 +1:0/0 = 0 +1:0/0/physics_layer_0/linear_velocity = Vector2(0, 0) +1:0/0/physics_layer_0/angular_velocity = 0.0 +2:0/0 = 0 +2:0/0/physics_layer_0/linear_velocity = Vector2(0, 0) +2:0/0/physics_layer_0/angular_velocity = 0.0 +3:0/0 = 0 +3:0/0/physics_layer_0/linear_velocity = Vector2(0, 0) +3:0/0/physics_layer_0/angular_velocity = 0.0 +4:0/0 = 0 +4:0/0/physics_layer_0/linear_velocity = Vector2(0, 0) +4:0/0/physics_layer_0/angular_velocity = 0.0 +4:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +5:0/0 = 0 +5:0/0/physics_layer_0/linear_velocity = Vector2(0, 0) +5:0/0/physics_layer_0/angular_velocity = 0.0 +5:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +6:0/0 = 0 +6:0/0/physics_layer_0/linear_velocity = Vector2(0, 0) +6:0/0/physics_layer_0/angular_velocity = 0.0 +7:0/size_in_atlas = Vector2i(1, 2) +7:0/0 = 0 +7:0/0/texture_origin = Vector2i(0, 8) +7:0/0/occlusion_layer_0/polygon = SubResource("OccluderPolygon2D_8jil2") +7:0/0/physics_layer_0/linear_velocity = Vector2(0, 0) +7:0/0/physics_layer_0/angular_velocity = 0.0 +7:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -4, 8, -4, 8, 3.5, 4.5, 8, -4, 8, -8, 4) +0:1/0 = 0 +0:1/0/physics_layer_0/linear_velocity = Vector2(0, 0) +0:1/0/physics_layer_0/angular_velocity = 0.0 +1:1/0 = 0 +1:1/0/physics_layer_0/linear_velocity = Vector2(0, 0) +1:1/0/physics_layer_0/angular_velocity = 0.0 +2:1/0 = 0 +2:1/0/physics_layer_0/linear_velocity = Vector2(0, 0) +2:1/0/physics_layer_0/angular_velocity = 0.0 +2:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +3:1/0 = 0 +3:1/0/physics_layer_0/linear_velocity = Vector2(0, 0) +3:1/0/physics_layer_0/angular_velocity = 0.0 +3:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +4:1/0 = 0 +4:1/0/physics_layer_0/linear_velocity = Vector2(0, 0) +4:1/0/physics_layer_0/angular_velocity = 0.0 +4:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +5:1/0 = 0 +5:1/0/physics_layer_0/linear_velocity = Vector2(0, 0) +5:1/0/physics_layer_0/angular_velocity = 0.0 +5:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +6:1/0 = 0 +6:1/0/physics_layer_0/linear_velocity = Vector2(0, 0) +6:1/0/physics_layer_0/angular_velocity = 0.0 +6:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +0:2/0 = 0 +0:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) +0:2/0/physics_layer_0/angular_velocity = 0.0 +0:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +1:2/0 = 0 +1:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) +1:2/0/physics_layer_0/angular_velocity = 0.0 +1:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +2:2/0 = 0 +2:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) +2:2/0/physics_layer_0/angular_velocity = 0.0 +3:2/0 = 0 +3:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) +3:2/0/physics_layer_0/angular_velocity = 0.0 +3:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +4:2/0 = 0 +4:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) +4:2/0/physics_layer_0/angular_velocity = 0.0 +5:2/0 = 0 +5:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) +5:2/0/physics_layer_0/angular_velocity = 0.0 +6:2/0 = 0 +6:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) +6:2/0/physics_layer_0/angular_velocity = 0.0 +7:2/0 = 0 +7:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) +7:2/0/physics_layer_0/angular_velocity = 0.0 +0:3/0 = 0 +0:3/0/physics_layer_0/linear_velocity = Vector2(0, 0) +0:3/0/physics_layer_0/angular_velocity = 0.0 +0:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +1:3/0 = 0 +1:3/0/physics_layer_0/linear_velocity = Vector2(0, 0) +1:3/0/physics_layer_0/angular_velocity = 0.0 +1:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +2:3/0 = 0 +2:3/0/physics_layer_0/linear_velocity = Vector2(0, 0) +2:3/0/physics_layer_0/angular_velocity = 0.0 +2:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +3:3/0 = 0 +3:3/0/physics_layer_0/linear_velocity = Vector2(0, 0) +3:3/0/physics_layer_0/angular_velocity = 0.0 +3:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +4:3/0 = 0 +4:3/0/physics_layer_0/linear_velocity = Vector2(0, 0) +4:3/0/physics_layer_0/angular_velocity = 0.0 +5:3/0 = 0 +5:3/0/physics_layer_0/linear_velocity = Vector2(0, 0) +5:3/0/physics_layer_0/angular_velocity = 0.0 +6:3/0 = 0 +6:3/0/physics_layer_0/linear_velocity = Vector2(0, 0) +6:3/0/physics_layer_0/angular_velocity = 0.0 +7:3/0 = 0 +7:3/0/physics_layer_0/linear_velocity = Vector2(0, 0) +7:3/0/physics_layer_0/angular_velocity = 0.0 + +[sub_resource type="OccluderPolygon2D" id="OccluderPolygon2D_kbvre"] +polygon = PackedVector2Array(-4, 8, -8, 4, -8, -4, -6, -4, -6, -20, 6, -20, 6, -4, 8, -4, 8, 4, 4, 8) + +[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_5yxvt"] +texture = ExtResource("2_wnjm0") +0:0/0 = 0 +0:0/0/physics_layer_0/linear_velocity = Vector2(0, 0) +0:0/0/physics_layer_0/angular_velocity = 0.0 +1:0/0 = 0 +1:0/0/physics_layer_0/linear_velocity = Vector2(0, 0) +1:0/0/physics_layer_0/angular_velocity = 0.0 +2:0/0 = 0 +2:0/0/physics_layer_0/linear_velocity = Vector2(0, 0) +2:0/0/physics_layer_0/angular_velocity = 0.0 +3:0/0 = 0 +3:0/0/physics_layer_0/linear_velocity = Vector2(0, 0) +3:0/0/physics_layer_0/angular_velocity = 0.0 +4:0/0 = 0 +4:0/0/physics_layer_0/linear_velocity = Vector2(0, 0) +4:0/0/physics_layer_0/angular_velocity = 0.0 +4:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +5:0/0 = 0 +5:0/0/physics_layer_0/linear_velocity = Vector2(0, 0) +5:0/0/physics_layer_0/angular_velocity = 0.0 +5:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +6:0/0 = 0 +6:0/0/physics_layer_0/linear_velocity = Vector2(0, 0) +6:0/0/physics_layer_0/angular_velocity = 0.0 +0:1/0 = 0 +0:1/0/physics_layer_0/linear_velocity = Vector2(0, 0) +0:1/0/physics_layer_0/angular_velocity = 0.0 +1:1/0 = 0 +1:1/0/physics_layer_0/linear_velocity = Vector2(0, 0) +1:1/0/physics_layer_0/angular_velocity = 0.0 +2:1/0 = 0 +2:1/0/physics_layer_0/linear_velocity = Vector2(0, 0) +2:1/0/physics_layer_0/angular_velocity = 0.0 +2:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +3:1/0 = 0 +3:1/0/physics_layer_0/linear_velocity = Vector2(0, 0) +3:1/0/physics_layer_0/angular_velocity = 0.0 +3:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +4:1/0 = 0 +4:1/0/physics_layer_0/linear_velocity = Vector2(0, 0) +4:1/0/physics_layer_0/angular_velocity = 0.0 +4:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +5:1/0 = 0 +5:1/0/physics_layer_0/linear_velocity = Vector2(0, 0) +5:1/0/physics_layer_0/angular_velocity = 0.0 +5:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +6:1/0 = 0 +6:1/0/physics_layer_0/linear_velocity = Vector2(0, 0) +6:1/0/physics_layer_0/angular_velocity = 0.0 +6:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +0:2/0 = 0 +0:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) +0:2/0/physics_layer_0/angular_velocity = 0.0 +0:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +1:2/0 = 0 +1:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) +1:2/0/physics_layer_0/angular_velocity = 0.0 +1:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +2:2/0 = 0 +2:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) +2:2/0/physics_layer_0/angular_velocity = 0.0 +3:2/0 = 0 +3:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) +3:2/0/physics_layer_0/angular_velocity = 0.0 +3:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 0, -8, 0) +4:2/0 = 0 +4:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) +4:2/0/physics_layer_0/angular_velocity = 0.0 +5:2/0 = 0 +5:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) +5:2/0/physics_layer_0/angular_velocity = 0.0 +6:2/0 = 0 +6:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) +6:2/0/physics_layer_0/angular_velocity = 0.0 +7:2/0 = 0 +7:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) +7:2/0/physics_layer_0/angular_velocity = 0.0 +0:3/0 = 0 +0:3/0/physics_layer_0/linear_velocity = Vector2(0, 0) +0:3/0/physics_layer_0/angular_velocity = 0.0 +0:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +1:3/0 = 0 +1:3/0/physics_layer_0/linear_velocity = Vector2(0, 0) +1:3/0/physics_layer_0/angular_velocity = 0.0 +1:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) +2:3/0 = 0 +2:3/0/physics_layer_0/linear_velocity = Vector2(0, 0) +2:3/0/physics_layer_0/angular_velocity = 0.0 +2:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 0, -8, 0, 8, -8, 8) +3:3/0 = 0 +3:3/0/physics_layer_0/linear_velocity = Vector2(0, 0) +3:3/0/physics_layer_0/angular_velocity = 0.0 +3:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(0, -8, 8, -8, 8, 8, 0, 8) +4:3/0 = 0 +4:3/0/physics_layer_0/linear_velocity = Vector2(0, 0) +4:3/0/physics_layer_0/angular_velocity = 0.0 +4:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(0, -8, 8, -8, 8, 0, 0, 0) +5:3/0 = 0 +5:3/0/physics_layer_0/linear_velocity = Vector2(0, 0) +5:3/0/physics_layer_0/angular_velocity = 0.0 +5:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 0, -8, 0, 0, -8, 0) +6:3/0 = 0 +6:3/0/physics_layer_0/linear_velocity = Vector2(0, 0) +6:3/0/physics_layer_0/angular_velocity = 0.0 +7:3/0 = 0 +7:3/0/physics_layer_0/linear_velocity = Vector2(0, 0) +7:3/0/physics_layer_0/angular_velocity = 0.0 +7:0/size_in_atlas = Vector2i(1, 2) +7:0/0 = 0 +7:0/0/texture_origin = Vector2i(0, 8) +7:0/0/occlusion_layer_0/polygon = SubResource("OccluderPolygon2D_kbvre") +7:0/0/physics_layer_0/linear_velocity = Vector2(0, 0) +7:0/0/physics_layer_0/angular_velocity = 0.0 +7:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) + +[sub_resource type="TileSet" id="TileSet_k1u48"] +occlusion_layer_0/light_mask = 1 +physics_layer_0/collision_layer = 1 +sources/2 = SubResource("TileSetAtlasSource_5yxvt") +sources/0 = SubResource("TileSetAtlasSource_fcd6d") + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_wurwd"] +resource_local_to_scene = true +shader = ExtResource("5_aevwf") +shader_parameter/color = Quaternion(1, 1, 1, 1) +shader_parameter/intensity = 0.0 + +[node name="TileMap" instance=ExtResource("1_ifiic")] +tile_set = SubResource("TileSet_k1u48") +layer_0/tile_data = PackedInt32Array(-524281, 458752, 0, -524284, 458752, 0, -262152, 458752, 0, -327673, 458752, 0, -131065, 458752, 0, -65544, 458752, 0, 131064, 458752, 0, 65543, 458752, 0, 262151, 458752, 0, 327672, 458752, 0, 524280, 458752, 0, 524283, 458752, 0, 524286, 458752, 0, 458753, 458752, 0, 458756, 458752, 0, 458759, 458752, 0, -458760, 458752, 0, -458757, 458752, 0, -524287, 458752, 0, -458754, 458752, 0, -524292, 458752, 3, -589821, 458752, 2, -589822, 393216, 3, -524291, 393216, 2, -589817, 393216, 0) +layer_3/tile_data = PackedInt32Array(-196612, 65536, 1, -131076, 65536, 1, -65540, 196608, 0, -4, 131072, 0, -196611, 65536, 1, -131075, 65536, 0, -65539, 131072, 0, -3, 196608, 0, -196610, 65536, 0, -131074, 65536, 1, -65538, 0, 0, -2, 65536, 0, -196609, 65536, 1, -131073, 65536, 1, -65537, 65536, 0, -1, 65536, 1, -458760, 0, 0, -393224, 196608, 0, -327688, 196608, 0, -262152, 0, 0, -196616, 65536, 0, -131080, 131072, 0, -65544, 196608, 0, -8, 131072, 0, 65528, 131072, 0, 131064, 196608, 0, 196600, 131072, 0, 262136, 65536, 0, 327672, 65536, 0, 393208, 65536, 0, 458744, 0, 0, 524280, 65536, 0, -458759, 0, 1, -393223, 131072, 0, -327687, 131072, 0, -262151, 65536, 0, -196615, 65536, 1, -131079, 131072, 0, -65543, 131072, 0, -7, 196608, 0, 65529, 196608, 0, 131065, 196608, 0, 196601, 131072, 0, 262137, 65536, 1, 327673, 0, 0, 393209, 65536, 1, 458745, 65536, 0, 524281, 65536, 1, -458758, 0, 0, -393222, 65536, 0, -327686, 0, 0, -262150, 65536, 0, -196614, 0, 0, -131078, 0, 1, -65542, 196608, 0, -6, 196608, 0, 65530, 65536, 1, 131066, 65536, 1, 196602, 65536, 1, 262138, 0, 0, 327674, 65536, 1, 393210, 65536, 0, 458746, 131072, 0, 524282, 131072, 0, -458757, 65536, 0, -393221, 65536, 1, -327685, 65536, 0, -262149, 65536, 0, -196613, 0, 1, -131077, 0, 1, -65541, 131072, 0, -5, 131072, 0, 65531, 65536, 0, 131067, 0, 1, 196603, 0, 0, 262139, 0, 1, 327675, 0, 0, 393211, 65536, 0, 458747, 131072, 0, 524283, 196608, 0, -458756, 0, 0, -393220, 0, 1, -327684, 0, 0, -262148, 0, 0, 65532, 65536, 0, 131068, 65536, 0, 196604, 65536, 1, 262140, 0, 1, 327676, 131072, 0, 393212, 196608, 0, 458748, 196608, 0, 524284, 196608, 0, -458755, 0, 1, -393219, 0, 1, -327683, 0, 1, -262147, 0, 0, 65533, 65536, 0, 131069, 65536, 1, 196605, 65536, 1, 262141, 0, 1, 327677, 196608, 0, 393213, 131072, 0, 458749, 196608, 0, 524285, 131072, 0, -458754, 65536, 1, -393218, 65536, 1, -327682, 131072, 0, -262146, 196608, 0, 65534, 0, 1, 131070, 65536, 0, 196606, 196608, 0, 262142, 131072, 0, 327678, 196608, 0, 393214, 131072, 0, 458750, 65536, 0, 524286, 0, 0, -458753, 0, 1, -393217, 0, 1, -327681, 196608, 0, -262145, 131072, 0, 65535, 0, 1, 131071, 65536, 1, 196607, 131072, 0, 262143, 196608, 0, 327679, 131072, 0, 393215, 131072, 0, 458751, 65536, 1, 524287, 0, 0, -524288, 65536, 1, -458752, 65536, 1, -393216, 196608, 0, -327680, 196608, 0, -262144, 65536, 0, -196608, 0, 1, -131072, 65536, 0, -65536, 65536, 0, 0, 65536, 0, 65536, 65536, 1, 131072, 65536, 0, 196608, 65536, 1, 262144, 65536, 0, 327680, 0, 1, 393216, 0, 0, 458752, 0, 1, -524287, 65536, 1, -458751, 0, 0, -393215, 196608, 0, -327679, 196608, 0, -262143, 0, 0, -196607, 65536, 1, -131071, 0, 1, -65535, 65536, 1, 1, 0, 0, 65537, 65536, 1, 131073, 65536, 0, 196609, 65536, 0, 262145, 65536, 1, 327681, 65536, 1, 393217, 0, 1, 458753, 65536, 1, -524286, 65536, 0, -458750, 65536, 0, -393214, 131072, 0, -327678, 196608, 0, -262142, 0, 0, -196606, 65536, 0, -131070, 196608, 0, -65534, 131072, 0, 2, 131072, 0, 65538, 196608, 0, 131074, 65536, 0, 196610, 0, 0, 262146, 0, 1, 327682, 65536, 0, 393218, 131072, 0, 458754, 131072, 0, -524285, 65536, 0, -458749, 65536, 0, -393213, 131072, 0, -327677, 196608, 0, -262141, 0, 0, -196605, 65536, 0, -131069, 131072, 0, -65533, 131072, 0, 3, 196608, 0, 65539, 196608, 0, 131075, 0, 0, 196611, 0, 1, 262147, 65536, 1, 327683, 65536, 1, 393219, 196608, 0, 458755, 196608, 0, -524284, 0, 1, -458748, 65536, 0, -393212, 65536, 0, -327676, 0, 0, -262140, 65536, 1, -196604, 0, 1, -131068, 0, 1, -65532, 0, 1, 4, 0, 0, 65540, 65536, 1, 131076, 0, 0, 196612, 65536, 0, 262148, 131072, 0, 327684, 196608, 0, 393220, 196608, 0, 458756, 196608, 0, -524283, 65536, 1, -458747, 65536, 0, -393211, 65536, 1, -327675, 0, 0, -262139, 0, 1, -196603, 0, 1, -131067, 0, 1, -65531, 65536, 1, 5, 65536, 0, 65541, 65536, 0, 131077, 65536, 0, 196613, 0, 0, 262149, 196608, 0, 327685, 196608, 0, 393221, 131072, 0, 458757, 131072, 0, -524282, 0, 1, -458746, 0, 1, -393210, 0, 0, -327674, 65536, 0, -262138, 0, 0, -196602, 0, 1, -131066, 131072, 0, -65530, 196608, 0, 6, 65536, 0, 65542, 65536, 0, 131078, 0, 0, 196614, 0, 1, 262150, 65536, 0, 327686, 65536, 1, 393222, 0, 1, 458758, 0, 1, -524281, 65536, 0, -458745, 65536, 0, -393209, 196608, 0, -327673, 196608, 0, -262137, 196608, 0, -196601, 131072, 0, -131065, 196608, 0, -65529, 131072, 0, 7, 0, 1, 65543, 65536, 1, 131079, 0, 1, 196615, 0, 0, 262151, 0, 0, 327687, 0, 1, 393223, 65536, 0, 458759, 0, 1) +layer_4/tile_data = PackedInt32Array(-524296, 327680, 0, -589818, 262144, 0, -589817, 262144, 1, -589819, 327680, 0, -589820, 196608, 1, -589821, 327680, 1, -589822, 131072, 1, -589823, 262144, 1, -589824, 327680, 0, -524289, 131072, 1, -524290, 327680, 0, -524291, 327680, 1, -524292, 327680, 1, -524293, 327680, 0, -524294, 131072, 1, -524295, 262144, 1, -589832, 131072, 2, -589831, 131072, 2, -589830, 131072, 2, -589829, 131072, 2, -589828, 131072, 2, -589827, 131072, 2, -589826, 131072, 2, -589825, 131072, 2, -655360, 131072, 2, -655359, 131072, 2, -655358, 131072, 2, -655357, 131072, 2, -655356, 131072, 2, -655355, 131072, 2, -655354, 131072, 2, -655353, 131072, 2, -655352, 327680, 2, -589833, 262144, 2, -524297, 196608, 3, -458761, 196608, 3, -393225, 196608, 3, -327689, 196608, 3, -262153, 196608, 3, -196617, 196608, 3, -131081, 196608, 3, -65545, 196608, 3, -9, 196608, 3, 65527, 196608, 3, 131063, 196608, 3, 196599, 196608, 3, 262135, 196608, 3, 327671, 196608, 3, 393207, 196608, 3, 458743, 196608, 3, 524279, 196608, 3, 262152, 131072, 3, 327688, 131072, 3, 393224, 131072, 3, 458760, 131072, 3, 196616, 131072, 3, 131080, 131072, 3, 65544, 131072, 3, 8, 131072, 3, -65528, 131072, 3, -131064, 131072, 3, -196600, 131072, 3, -262136, 131072, 3, -589816, 131072, 3, -524280, 131072, 3, -458744, 131072, 3, -393208, 131072, 3, -327672, 131072, 3, 589816, 196608, 2, 589817, 196608, 2, 589818, 196608, 2, 589819, 196608, 2, 589820, 196608, 2, 589821, 196608, 2, 589822, 196608, 2, 589823, 196608, 2, 524288, 196608, 2, 524289, 196608, 2, 524290, 196608, 2, 524291, 196608, 2, 524292, 196608, 2, 524293, 196608, 2, 524294, 196608, 2, 524295, 196608, 2, 524296, 327680, 3, 589815, 262144, 3) + +[node name="CanvasModulate" parent="." index="0"] +color = Color(0.753984, 0.753984, 0.753984, 1) + +[node name="Doc" parent="Entities" index="0" instance=ExtResource("4_c0csw")] +material = SubResource("ShaderMaterial_wurwd") +PreferredWeightDistance = 256.0 +MaxWeightDistance = 32.0 +Health = 1000.0 diff --git a/Scenes/Maps/Hills.tscn b/Scenes/Maps/Hills.tscn index 4fe0066..3abe54d 100644 --- a/Scenes/Maps/Hills.tscn +++ b/Scenes/Maps/Hills.tscn @@ -212,31 +212,31 @@ physics_layer_0/collision_mask = 16 physics_layer_1/collision_layer = 1 sources/0 = SubResource("TileSetAtlasSource_dvbe3") -[sub_resource type="ShaderMaterial" id="ShaderMaterial_3sxqg"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_lhxal"] resource_local_to_scene = true shader = ExtResource("4_mwgaq") shader_parameter/color = Quaternion(1, 1, 1, 1) shader_parameter/intensity = 0.0 -[sub_resource type="ShaderMaterial" id="ShaderMaterial_r3w8l"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_ypbiq"] resource_local_to_scene = true shader = ExtResource("4_mwgaq") shader_parameter/color = Quaternion(1, 1, 1, 1) shader_parameter/intensity = 0.0 -[sub_resource type="ShaderMaterial" id="ShaderMaterial_2oi7o"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_rl34k"] resource_local_to_scene = true shader = ExtResource("4_mwgaq") shader_parameter/color = Quaternion(1, 1, 1, 1) shader_parameter/intensity = 0.0 -[sub_resource type="ShaderMaterial" id="ShaderMaterial_65pfr"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_txxdc"] resource_local_to_scene = true shader = ExtResource("4_mwgaq") shader_parameter/color = Quaternion(1, 1, 1, 1) shader_parameter/intensity = 0.0 -[sub_resource type="ShaderMaterial" id="ShaderMaterial_5a7w6"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_rqx80"] resource_local_to_scene = true shader = ExtResource("4_mwgaq") shader_parameter/color = Quaternion(1, 1, 1, 1) @@ -268,23 +268,23 @@ layer_4/tile_data = PackedInt32Array(1114105, 196608, 3, 1114106, 262144, 3, 111 layer_5/tile_data = PackedInt32Array(786438, 262144, 3, 720899, 262144, 3, 851971, 458752, 3, 196611, 458752, 3, 1835019, 262144, 3, 1835034, 458752, 3) [node name="ExampleEnemy" parent="Entities" index="0" instance=ExtResource("3_hwof6")] -material = SubResource("ShaderMaterial_3sxqg") +material = SubResource("ShaderMaterial_lhxal") position = Vector2(169, 115) [node name="ExampleEnemy2" parent="Entities" index="1" instance=ExtResource("3_hwof6")] -material = SubResource("ShaderMaterial_r3w8l") +material = SubResource("ShaderMaterial_ypbiq") position = Vector2(75, 130) [node name="ExampleEnemy3" parent="Entities" index="2" instance=ExtResource("3_hwof6")] -material = SubResource("ShaderMaterial_2oi7o") +material = SubResource("ShaderMaterial_rl34k") position = Vector2(140, 177) [node name="ExampleEnemy4" parent="Entities" index="3" instance=ExtResource("3_hwof6")] -material = SubResource("ShaderMaterial_65pfr") +material = SubResource("ShaderMaterial_txxdc") position = Vector2(14, 159) [node name="ExampleEnemy5" parent="Entities" index="4" instance=ExtResource("3_hwof6")] -material = SubResource("ShaderMaterial_5a7w6") +material = SubResource("ShaderMaterial_rqx80") position = Vector2(10, 22) Faction = 1 diff --git a/State/NPC/Doc/DocAttackState.cs b/State/NPC/Doc/DocAttackState.cs new file mode 100644 index 0000000..bf37294 --- /dev/null +++ b/State/NPC/Doc/DocAttackState.cs @@ -0,0 +1,86 @@ +using Godot; +using GodotUtilities; + +namespace SupaLidlGame.State.NPC.Doc; + +public partial class DocAttackState : NPCState +{ + private Scenes.Map _map; + private Utils.World _world; + + private double _currentDuration = 0; + private double _currentAttackDuration = 0; + + [Export] + public double Duration { get; set; } + + [Export] + public double AttackDuration { get; set; } + + [Export] + public PackedScene Projectile { get; set; } + + [Export] + public DocExitState ExitState { get; set; } + + private float _intensity = 1; + + public override NPCState Enter(IState previousState) + { + _map = this.GetAncestor(); + _world = this.GetAncestor(); + _currentDuration = Duration; + _currentAttackDuration = AttackDuration; + return null; + } + + public override void Exit(IState nextState) + { + + } + + private void SpawnProjectile(Vector2 position, Vector2 direction) + { + var projectile = _map.SpawnEntity(Projectile); + projectile.Hitbox.Faction = NPC.Faction; + // global position is (from npc to player) * 2 = (2 * npc) - player + //projectile.GlobalPosition = 2 * NPC.GlobalPosition - playerPos; + projectile.GlobalPosition = position; + projectile.Direction = direction; + projectile.GlobalRotation = direction.Angle(); + projectile.Delay = 1 / _intensity; + } + + public override NPCState Process(double delta) + { + if ((_currentDuration -= delta) <= 0) + { + return ExitState; + } + + if (NPC.Health < 500) + { + _intensity = 2; + } + + if (NPC.Health < 250) + { + _intensity = 3; + } + + if ((_currentAttackDuration -= delta) <= 0) + { + var player = _world.CurrentPlayer; + var playerPos = player.GlobalPosition; + Vector2 position1 = 2 * NPC.GlobalPosition - playerPos; + Vector2 position2 = 2 * playerPos - NPC.GlobalPosition; + Vector2 direction1 = position1.DirectionTo(playerPos); + Vector2 direction2 = -direction1; + SpawnProjectile(position1, direction1); + SpawnProjectile(position2, direction2); + _currentAttackDuration = AttackDuration / _intensity; + } + + return null; + } +} diff --git a/State/NPC/Doc/DocExitState.cs b/State/NPC/Doc/DocExitState.cs new file mode 100644 index 0000000..b924cc1 --- /dev/null +++ b/State/NPC/Doc/DocExitState.cs @@ -0,0 +1,38 @@ +using Godot; + +namespace SupaLidlGame.State.NPC.Doc; + +public partial class DocExitState : NPCState +{ + [Export] + public AnimationPlayer TelegraphAnimationPlayer { get; set; } + + [Export] + public DocTelegraphState TelegraphState { get; set; } + + [Export] + public double Duration { get; set; } = 1; + + private double _currentDuration = 0; + + public override NPCState Enter(IState previousState) + { + _currentDuration = Duration; + TelegraphAnimationPlayer.Play("exit_out"); + return null; + } + + public override void Exit(IState nextState) + { + + } + + public override NPCState Process(double delta) + { + if ((_currentDuration -= delta) <= 0) + { + return TelegraphState; + } + return null; + } +} diff --git a/State/NPC/Doc/DocTelegraphState.cs b/State/NPC/Doc/DocTelegraphState.cs new file mode 100644 index 0000000..c19cdcd --- /dev/null +++ b/State/NPC/Doc/DocTelegraphState.cs @@ -0,0 +1,41 @@ +using Godot; + +namespace SupaLidlGame.State.NPC.Doc; + +public partial class DocTelegraphState : NPCState +{ + [Export] + public AnimationPlayer TelegraphAnimationPlayer { get; set; } + + [Export] + public DocAttackState AttackState { get; set; } + + [Export] + public double Duration { get; set; } = 1; + + private double _currentDuration = 1; + + public override NPCState Enter(IState previousState) + { + _currentDuration = Duration; + TelegraphAnimationPlayer.Play("enter_in"); + float randX = GD.RandRange(-128, 128); + float randY = GD.RandRange(-128, 128); + NPC.GlobalPosition = new Vector2(randX, randY); + return null; + } + + public override void Exit(IState nextState) + { + + } + + public override NPCState Process(double delta) + { + if ((_currentDuration -= delta) <= 0) + { + return AttackState; + } + return null; + } +} diff --git a/State/NPC/NPCState.cs b/State/NPC/NPCState.cs new file mode 100644 index 0000000..44564a8 --- /dev/null +++ b/State/NPC/NPCState.cs @@ -0,0 +1,18 @@ +using Godot; + +namespace SupaLidlGame.State.NPC; + +public abstract partial class NPCState : Node, IState +{ + [Export] + public SupaLidlGame.Characters.NPC NPC { get; set; } + + public abstract IState Enter(IState previousState); + + public virtual void Exit(IState nextState) + { + + } + + public virtual IState Process(double delta) => null; +} diff --git a/State/NPC/NPCStateMachine.cs b/State/NPC/NPCStateMachine.cs new file mode 100644 index 0000000..8905a58 --- /dev/null +++ b/State/NPC/NPCStateMachine.cs @@ -0,0 +1,18 @@ +using Godot; + +namespace SupaLidlGame.State.NPC; + +public partial class NPCStateMachine : StateMachine +{ + [Export] + public override NPCState InitialState { get; set; } + + public void Process(double delta) + { + var state = CurrentState.Process(delta); + if (state is NPCState s) + { + ChangeState(s); + } + } +} diff --git a/State/NPC/TelegraphState.cs b/State/NPC/TelegraphState.cs new file mode 100644 index 0000000..ee35116 --- /dev/null +++ b/State/NPC/TelegraphState.cs @@ -0,0 +1,19 @@ +using Godot; + +namespace SupaLidlGame.State.NPC; + +public partial class NPCTelegraphState : NPCState +{ + [Export] + public double Duration { get; set; } + + public override NPCState Enter(IState previousState) + { + return null; + } + + public override void Exit(IState nextState) + { + + } +} diff --git a/project.godot b/project.godot index 8bdfda5..e50529c 100644 --- a/project.godot +++ b/project.godot @@ -95,3 +95,7 @@ equip_3={ [physics] 2d/default_gravity=0.0 + +[rendering] + +environment/defaults/default_clear_color=Color(0.301961, 0.301961, 0.301961, 1)