From 2833e761758fbdb08c236730e7d048cf6c91878d Mon Sep 17 00:00:00 2001 From: HumanoidSandvichDispenser Date: Tue, 13 Jun 2023 02:55:30 -0700 Subject: [PATCH] supa wip --- BoundingBoxes/InteractionTrigger.tscn | 14 +++++++ Characters/Character.cs | 20 +++++----- Characters/NPC.cs | 7 +++- Characters/Player.cs | 18 +++++++++ Characters/Player.tscn | 34 +++++++++++++++- Entities/Campfire.tscn | 57 ++++++++++++++++++++++----- Extensions/AudioStreamPlayer2D.cs | 12 +++++- Extensions/Node.cs | 3 +- Extensions/Node2DExtensions.cs | 29 ++++++++++++++ Extensions/Particles2D.cs | 14 +++++++ Items/Weapons/Railgun.cs | 2 +- Items/Weapons/Sword.cs | 3 +- Scenes/Maps/Hills.tscn | 42 ++++++++++++++------ State/Character/CharacterState.cs | 7 ++++ State/Character/PlayerRollState.cs | 2 +- SupaLidlGame.csproj | 2 +- Utils/Spawner.cs | 1 + Utils/World.cs | 11 ++++-- project.godot | 4 +- 19 files changed, 239 insertions(+), 43 deletions(-) create mode 100644 BoundingBoxes/InteractionTrigger.tscn create mode 100644 Extensions/Particles2D.cs diff --git a/BoundingBoxes/InteractionTrigger.tscn b/BoundingBoxes/InteractionTrigger.tscn new file mode 100644 index 0000000..48e8d89 --- /dev/null +++ b/BoundingBoxes/InteractionTrigger.tscn @@ -0,0 +1,14 @@ +[gd_scene load_steps=3 format=3 uid="uid://dldnp8eunxj3q"] + +[ext_resource type="Script" path="res://BoundingBoxes/InteractionTrigger.cs" id="1_uoemj"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_dfj3a"] + +[node name="InteractionTrigger" type="Area2D"] +collision_layer = 64 +collision_mask = 0 +script = ExtResource("1_uoemj") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource("RectangleShape2D_dfj3a") +debug_color = Color(0.905882, 0, 0.745098, 0.419608) diff --git a/Characters/Character.cs b/Characters/Character.cs index 9bb77e6..12f58e7 100644 --- a/Characters/Character.cs +++ b/Characters/Character.cs @@ -1,4 +1,5 @@ using Godot; +using GodotUtilities; using SupaLidlGame.Extensions; using SupaLidlGame.Items; using SupaLidlGame.Utils; @@ -95,14 +96,6 @@ public partial class Character : CharacterBody2D, IFaction DrawTarget(); } - public override void _Input(InputEvent @event) - { - if (StateMachine != null) - { - StateMachine.Input(@event); - } - } - public override void _PhysicsProcess(double delta) { if (StateMachine != null) @@ -188,6 +181,11 @@ public partial class Character : CharacterBody2D, IFaction Vector2 knockbackOrigin = default, Vector2 knockbackVector = default) { + if (Health <= 0) + { + return; + } + float oldHealth = Health; Health -= damage; @@ -232,7 +230,7 @@ public partial class Character : CharacterBody2D, IFaction if (this.GetNode("HurtSound") is AudioStreamPlayer2D sound) { // very small pitch deviation - sound.At(GlobalPosition).WithPitchDeviation(0.125f).Play(); + sound.At(GlobalPosition).WithPitchDeviation(0.125f).PlayOneShot(); } Events.HealthChangedArgs args = new Events.HealthChangedArgs @@ -242,11 +240,15 @@ public partial class Character : CharacterBody2D, IFaction NewHealth = Health, Damage = damage, }; + EmitSignal(SignalName.Hurt, args); if (Health <= 0) { EmitSignal(SignalName.Death, args); + GetNode("DeathParticles") + .CloneOnWorld() + .EmitOneShot(); } } } diff --git a/Characters/NPC.cs b/Characters/NPC.cs index 1e34d27..96ecb65 100644 --- a/Characters/NPC.cs +++ b/Characters/NPC.cs @@ -92,8 +92,13 @@ public partial class NPC : Character Character bestChar = null; foreach (Node node in GetParent().GetChildren()) { - if (node is Character character && character.Faction != Faction) + if (node is Character character) { + if (character.Faction == Faction || character.Health <= 0) + { + continue; + } + float dist = Position.DistanceTo(character.Position); if (dist < bestDist) { diff --git a/Characters/Player.cs b/Characters/Player.cs index 6ba86b5..1891a2f 100644 --- a/Characters/Player.cs +++ b/Characters/Player.cs @@ -47,6 +47,24 @@ public sealed partial class Player : Character _sprite.Animation = _spriteAnim; } base._Ready(); + Death += (Events.HealthChangedArgs args) => + { + Visible = false; + }; + } + + public override void _Input(InputEvent @event) + { + if (StateMachine != null) + { + StateMachine.Input(@event); + } + } + + public void Spawn() + { + Health = 100; + Visible = true; } public override void ModifyVelocity() diff --git a/Characters/Player.tscn b/Characters/Player.tscn index 519fd5e..b18c399 100644 --- a/Characters/Player.tscn +++ b/Characters/Player.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=33 format=3 uid="uid://b2254pup8k161"] +[gd_scene load_steps=37 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"] @@ -172,6 +172,30 @@ _data = { "roll": SubResource("Animation_rx2pj") } +[sub_resource type="Gradient" id="Gradient_3tax5"] +offsets = PackedFloat32Array(0.533333, 1) +colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 0) + +[sub_resource type="GradientTexture1D" id="GradientTexture1D_pjeh8"] +gradient = SubResource("Gradient_3tax5") + +[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_humq0"] +emission_shape = 1 +emission_sphere_radius = 1.0 +particle_flag_disable_z = true +direction = Vector3(0, 0, 0) +spread = 180.0 +gravity = Vector3(0, 0, 0) +initial_velocity_min = 32.0 +initial_velocity_max = 32.0 +orbit_velocity_min = 0.0 +orbit_velocity_max = 0.1 +tangential_accel_min = 64.0 +tangential_accel_max = 64.0 +color_ramp = SubResource("GradientTexture1D_pjeh8") + +[sub_resource type="CanvasTexture" id="CanvasTexture_pited"] + [node name="Player" type="CharacterBody2D" node_paths=PackedStringArray("Camera", "DirectionMarker", "Sprite", "Inventory", "StateMachine", "Hurtbox")] y_sort_enabled = true texture_filter = 3 @@ -289,4 +313,12 @@ collision_mask = 64 collide_with_areas = true script = ExtResource("13_hs3u1") +[node name="DeathParticles" type="GPUParticles2D" parent="."] +emitting = false +amount = 16 +process_material = SubResource("ParticleProcessMaterial_humq0") +texture = SubResource("CanvasTexture_pited") +one_shot = true +explosiveness = 0.9 + [editable path="Hurtbox"] diff --git a/Entities/Campfire.tscn b/Entities/Campfire.tscn index b42c4c8..03bf26c 100644 --- a/Entities/Campfire.tscn +++ b/Entities/Campfire.tscn @@ -1,9 +1,9 @@ -[gd_scene load_steps=13 format=3 uid="uid://dhl071rj5wyvx"] +[gd_scene load_steps=18 format=3 uid="uid://dhl071rj5wyvx"] [ext_resource type="Texture2D" uid="uid://yqet0b22i70d" path="res://Assets/Sprites/campfire.png" id="1_7eor7"] [ext_resource type="Script" path="res://Entities/Campfire.cs" id="1_w4gfp"] [ext_resource type="Texture2D" uid="uid://coarr28adgo1u" path="res://Assets/Sprites/Particles/point-light.png" id="3_lm3vq"] -[ext_resource type="Script" path="res://BoundingBoxes/InteractionTrigger.cs" id="4_h1bqe"] +[ext_resource type="PackedScene" uid="uid://dldnp8eunxj3q" path="res://BoundingBoxes/InteractionTrigger.tscn" id="4_yoo3p"] [sub_resource type="AtlasTexture" id="AtlasTexture_68qj1"] atlas = ExtResource("1_7eor7") @@ -56,9 +56,41 @@ animations = [{ [sub_resource type="RectangleShape2D" id="RectangleShape2D_ubam4"] size = Vector2(16, 4) -[sub_resource type="RectangleShape2D" id="RectangleShape2D_dfj3a"] +[sub_resource type="RectangleShape2D" id="RectangleShape2D_p0hsm"] size = Vector2(20, 10) +[sub_resource type="Gradient" id="Gradient_cr0xb"] +offsets = PackedFloat32Array(0, 0.644444, 1) +colors = PackedColorArray(2, 1.6, 0.8, 1, 0.863171, 0.393552, 0.380535, 1, 0.304405, 0.24341, 0.229614, 1) + +[sub_resource type="GradientTexture1D" id="GradientTexture1D_pjqf7"] +gradient = SubResource("Gradient_cr0xb") + +[sub_resource type="Curve" id="Curve_jm83f"] +_data = [Vector2(0.144578, 1), 0.0, 0.0, 0, 0, Vector2(1, 0.4), 0.0, 0.0, 0, 0] +point_count = 2 + +[sub_resource type="CurveTexture" id="CurveTexture_jpefi"] +curve = SubResource("Curve_jm83f") + +[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_xtx2m"] +emission_shape = 1 +emission_sphere_radius = 5.0 +particle_flag_disable_z = true +direction = Vector3(0, -1, 0) +spread = 0.0 +gravity = Vector3(0, -16, 0) +initial_velocity_min = 16.0 +initial_velocity_max = 16.0 +orbit_velocity_min = 0.0 +orbit_velocity_max = 0.0 +radial_accel_min = -40.0 +radial_accel_max = -20.0 +scale_min = 2.0 +scale_max = 4.0 +scale_curve = SubResource("CurveTexture_jpefi") +color_ramp = SubResource("GradientTexture1D_pjqf7") + [node name="Campfire" type="StaticBody2D"] texture_filter = 3 position = Vector2(0, -8) @@ -66,12 +98,14 @@ script = ExtResource("1_w4gfp") [node name="Sprite2D" type="AnimatedSprite2D" parent="."] sprite_frames = SubResource("SpriteFrames_o6lfi") -frame_progress = 0.387757 +animation = &"active" +frame_progress = 0.343741 [node name="PointLight2D" type="PointLight2D" parent="."] color = Color(0.996078, 0.780392, 0.615686, 1) energy = 2.0 blend_mode = 2 +shadow_enabled = true texture = ExtResource("3_lm3vq") texture_scale = 0.25 @@ -79,11 +113,14 @@ texture_scale = 0.25 position = Vector2(0, 6) shape = SubResource("RectangleShape2D_ubam4") -[node name="InteractionTrigger" type="Area2D" parent="."] -collision_layer = 64 -collision_mask = 0 -script = ExtResource("4_h1bqe") +[node name="InteractionTrigger" parent="." instance=ExtResource("4_yoo3p")] -[node name="CollisionShape2D" type="CollisionShape2D" parent="InteractionTrigger"] +[node name="CollisionShape2D" parent="InteractionTrigger" index="0"] position = Vector2(0, 5) -shape = SubResource("RectangleShape2D_dfj3a") +shape = SubResource("RectangleShape2D_p0hsm") + +[node name="GPUParticles2D" type="GPUParticles2D" parent="."] +amount = 40 +process_material = SubResource("ParticleProcessMaterial_xtx2m") + +[editable path="InteractionTrigger"] diff --git a/Extensions/AudioStreamPlayer2D.cs b/Extensions/AudioStreamPlayer2D.cs index 20bdb4d..0258eb3 100644 --- a/Extensions/AudioStreamPlayer2D.cs +++ b/Extensions/AudioStreamPlayer2D.cs @@ -1,4 +1,5 @@ using Godot; +using GodotUtilities; using System; namespace SupaLidlGame.Extensions; @@ -43,7 +44,7 @@ public static class AudioStreamPlayer2DExtensions this AudioStreamPlayer2D audio, Vector2 globalPosition) { - var world = audio.GetTree().Root.GetNode("World/TileMap"); + var world = audio.GetAncestor(); if (world is null) { throw new NullReferenceException("World does not exist"); @@ -61,6 +62,15 @@ public static class AudioStreamPlayer2DExtensions return clone; } + public static AudioStreamPlayer2D PlayOneShot( + this AudioStreamPlayer2D audio, + float fromPosition = 0) + { + audio.Finished += () => audio.QueueFree(); + audio.Play(fromPosition); + return audio; + } + public static AudioStreamPlayer2D WithPitchDeviation( this AudioStreamPlayer2D audio, float deviation) diff --git a/Extensions/Node.cs b/Extensions/Node.cs index ee52e80..cf7191c 100644 --- a/Extensions/Node.cs +++ b/Extensions/Node.cs @@ -8,7 +8,8 @@ public static class NodeExtensions /// Iterates through each ancestor until it finds an ancestor of type /// T /// - public static T GetAncestor(this Node node) where T : Node + [System.Obsolete] + public static T GetAncestorDeprecated(this Node node) where T : Node { Node parent; diff --git a/Extensions/Node2DExtensions.cs b/Extensions/Node2DExtensions.cs index 694fb45..ab70549 100644 --- a/Extensions/Node2DExtensions.cs +++ b/Extensions/Node2DExtensions.cs @@ -1,4 +1,5 @@ using Godot; +using GodotUtilities; namespace SupaLidlGame.Extensions; @@ -9,4 +10,32 @@ public static class Node2DExtensions //var spaceState = node.GetWorld2d().DirectSpaceState; //var result = spaceState.IntersectRay(); } + + public static Node CloneOnWorld(this Node2D node) + { + return CloneOnWorld(node); + } + + public static T CloneOnWorld(this Node2D node) where T : Node2D + { + var world = node.GetAncestor(); + if (world is null) + { + throw new System.NullReferenceException("World does not exist"); + } + + //var parent = new Node2D(); + //world.AddChild(parent); + //parent.GlobalPosition = node.GlobalPosition; + var clone = node.Duplicate() as T; + world.AddChild(clone); + clone.GlobalPosition = node.GlobalPosition; + return clone; + } + + public static Node AtPosition(this Node2D node, Vector2 position) + { + node.GlobalPosition = position; + return node; + } } diff --git a/Extensions/Particles2D.cs b/Extensions/Particles2D.cs new file mode 100644 index 0000000..fb76d57 --- /dev/null +++ b/Extensions/Particles2D.cs @@ -0,0 +1,14 @@ +using Godot; + +namespace SupaLidlGame.Extensions; + +public static class Particles2D +{ + public static void EmitOneShot(this GpuParticles2D particles) + { + particles.GetTree().CreateTimer(particles.Lifetime).Timeout += () => + { + particles.QueueFree(); + }; + } +} diff --git a/Items/Weapons/Railgun.cs b/Items/Weapons/Railgun.cs index 4ebed2a..d6f93d0 100644 --- a/Items/Weapons/Railgun.cs +++ b/Items/Weapons/Railgun.cs @@ -1,5 +1,5 @@ using Godot; -using SupaLidlGame.Extensions; +using GodotUtilities; namespace SupaLidlGame.Items.Weapons; diff --git a/Items/Weapons/Sword.cs b/Items/Weapons/Sword.cs index 826116a..12a719d 100644 --- a/Items/Weapons/Sword.cs +++ b/Items/Weapons/Sword.cs @@ -1,4 +1,5 @@ using Godot; +using GodotUtilities; using SupaLidlGame.BoundingBoxes; using SupaLidlGame.Characters; using SupaLidlGame.Extensions; @@ -197,7 +198,7 @@ public partial class Sword : Weapon, IParryable IsParried = true; AnimationPlayer.SpeedScale = 0.25f; Character.Stun(1.5f); - GetNode("ParrySound").OnWorld().Play(); + GetNode("ParrySound").OnWorld().PlayOneShot(); } public override void _on_hitbox_hit(BoundingBox box) diff --git a/Scenes/Maps/Hills.tscn b/Scenes/Maps/Hills.tscn index 0a34a83..4fe0066 100644 --- a/Scenes/Maps/Hills.tscn +++ b/Scenes/Maps/Hills.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=15 format=3 uid="uid://bxtpv6jqodj4v"] +[gd_scene load_steps=18 format=3 uid="uid://bxtpv6jqodj4v"] [ext_resource type="PackedScene" uid="uid://clwv2owvk6abe" path="res://Scenes/BaseMap.tscn" id="1_vly6f"] [ext_resource type="Texture2D" uid="uid://dl2h266oa2x31" path="res://Assets/Sprites/night-grass.png" id="2_ote21"] @@ -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_qliqj"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_3sxqg"] 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_xpy5p"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_r3w8l"] 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_jlmdb"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_2oi7o"] 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_pd2a6"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_65pfr"] 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_th2v6"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_5a7w6"] resource_local_to_scene = true shader = ExtResource("4_mwgaq") shader_parameter/color = Quaternion(1, 1, 1, 1) @@ -245,6 +245,22 @@ shader_parameter/intensity = 0.0 [sub_resource type="RectangleShape2D" id="RectangleShape2D_oods2"] size = Vector2(128, 64) +[sub_resource type="Gradient" id="Gradient_rg6hp"] +colors = PackedColorArray(0.941579, 6.06447e-06, 0.603405, 1, 1, 1, 1, 1) + +[sub_resource type="GradientTexture1D" id="GradientTexture1D_pdu88"] +gradient = SubResource("Gradient_rg6hp") + +[sub_resource type="Environment" id="Environment_c0b2h"] +background_mode = 3 +glow_enabled = true +glow_intensity = 1.2 +glow_strength = 0.8 +glow_bloom = 0.1 +glow_blend_mode = 0 +adjustment_enabled = true +adjustment_color_correction = SubResource("GradientTexture1D_pdu88") + [node name="TileMap" instance=ExtResource("1_vly6f")] tile_set = SubResource("TileSet_7f7fo") layer_3/tile_data = PackedInt32Array(786426, 262144, 1, 851962, 262144, 1, 917498, 262144, 1, 983034, 262144, 1, 786427, 262144, 1, 851963, 262144, 1, 917499, 262144, 1, 983035, 262144, 1, 786428, 262144, 1, 851964, 262144, 1, 917500, 262144, 1, 983036, 262144, 1, 786429, 262144, 1, 851965, 262144, 1, 917501, 262144, 1, 983037, 262144, 1, 786430, 262144, 1, 851966, 262144, 1, 917502, 262144, 1, 983038, 262144, 1, 786431, 262144, 1, 851967, 262144, 1, 917503, 262144, 1, 983039, 262144, 1, 720896, 262144, 1, 786432, 262144, 1, 851968, 262144, 1, 917504, 262144, 1, 1048573, 262144, 1, 1048574, 262144, 1, 1048575, 262144, 1, 983040, 262144, 1, 1048576, 262144, 1, 1114112, 262144, 1, 1179647, 262144, 1, 1179646, 262144, 1, 1179645, 262144, 1, 1114109, 262144, 1, 1114110, 262144, 1, 1114111, 262144, 1, 1245183, 262144, 1, 1310719, 262144, 1, 1376255, 262144, 1, 1310720, 131072, 3, 1376256, 262144, 1, 1441791, 262144, 1, 1245184, 131072, 3, 1179648, 131072, 3, 1179649, 131072, 3, 1179650, 131072, 3, 1179651, 131072, 3, 1114115, 262144, 1, 1114114, 262144, 1, 1114113, 262144, 1, 1114116, 262144, 1, 1114117, 262144, 1, 1114118, 262144, 1, 1114119, 262144, 1, 1114120, 262144, 1, 1114121, 262144, 1, 1114122, 262144, 1, 1114123, 262144, 1, 1179659, 262144, 1, 1245195, 262144, 1, 1310731, 262144, 1, 1376266, 262144, 1, 1376265, 262144, 1, 1376264, 262144, 1, 1376263, 262144, 1, 1376262, 262144, 1, 1376261, 262144, 1, 1376260, 262144, 1, 1376259, 131072, 3, 1376258, 131072, 3, 1376257, 262144, 1, 1310721, 131072, 3, 1245185, 131072, 4, 1245186, 131072, 4, 1310722, 131072, 3, 1245187, 131072, 3, 1179652, 262144, 1, 1179653, 262144, 1, 1179654, 262144, 1, 1179655, 262144, 1, 1179656, 262144, 1, 1179657, 262144, 1, 1179658, 262144, 1, 1376267, 262144, 1, 1310728, 262144, 1, 1310727, 262144, 1, 1310726, 262144, 1, 1310725, 131072, 3, 1310724, 131072, 3, 1310723, 131072, 3, 1245188, 131072, 3, 1245189, 131072, 3, 1245190, 262144, 1, 1245191, 262144, 1, 1245192, 262144, 1, 1245193, 262144, 1, 1245194, 262144, 1, 1310730, 262144, 1, 1310729, 262144, 1, 524285, 262144, 1, 589821, 262144, 1, 655357, 262144, 1, 720893, 262144, 1, 720894, 262144, 1, 655358, 131072, 3, 589822, 262144, 1, 524286, 262144, 1, 524287, 262144, 1, 458752, 262144, 1, 458753, 262144, 1, 458754, 262144, 1, 458755, 262144, 1, 458756, 262144, 1, 458757, 262144, 1, 458758, 262144, 1, 458759, 262144, 1, 458760, 262144, 1, 458764, 262144, 1, 524300, 262144, 1, 589836, 262144, 1, 655372, 262144, 1, 720908, 262144, 1, 786444, 131072, 3, 851980, 131072, 4, 851981, 131072, 4, 851982, 262144, 1, 786446, 262144, 1, 720910, 262144, 1, 720909, 262144, 1, 786445, 262144, 1, 851979, 131072, 4, 851978, 262144, 1, 851977, 262144, 1, 851976, 262144, 1, 851975, 262144, 1, 786439, 262144, 1, 786440, 262144, 1, 786441, 262144, 1, 786442, 131072, 3, 786443, 131072, 3, 720907, 262144, 1, 655371, 262144, 1, 589834, 131072, 3, 524298, 262144, 1, 524297, 131072, 3, 524294, 262144, 1, 524293, 262144, 1, 524292, 262144, 1, 524291, 262144, 1, 524290, 262144, 1, 524289, 131072, 3, 524288, 131072, 3, 589824, 131072, 3, 655359, 131072, 4, 720895, 131072, 3, 589823, 131072, 3, 655360, 131072, 3, 655361, 131072, 3, 655362, 131072, 3, 655363, 262144, 1, 655364, 262144, 1, 655366, 262144, 1, 655367, 131072, 3, 655368, 131072, 3, 655369, 131072, 3, 655370, 131072, 3, 720906, 262144, 1, 720905, 262144, 1, 720904, 262144, 1, 720903, 262144, 1, 720902, 262144, 1, 720901, 262144, 1, 720900, 262144, 1, 589828, 262144, 1, 589827, 262144, 1, 589826, 262144, 1, 589825, 131072, 3, 589829, 262144, 1, 589832, 131072, 4, 589833, 131072, 4, 589835, 131072, 3, 524299, 262144, 1, 393220, 262144, 1, 393221, 262144, 1, 393222, 262144, 1, 393223, 262144, 1, 393224, 262144, 1, 393225, 262144, 1, 393226, 262144, 1, 393227, 262144, 1, 393229, 262144, 1, 393230, 262144, 1, 327694, 262144, 1, 327692, 262144, 1, 327691, 262144, 1, 262155, 262144, 1, 262156, 262144, 1, 196621, 131072, 4, 196622, 262144, 1, 262157, 262144, 1, -131063, 262144, 1, -65527, 262144, 1, -65526, 262144, 1, 9, 262144, 1, -131062, 262144, 1, -131061, 262144, 1, -65525, 262144, 1, 10, 262144, 1, 11, 131072, 3, 65547, 262144, 1, 131083, 262144, 1, 196619, 262144, 1, 196620, 262144, 1, 131084, 131072, 3, 131085, 131072, 4, 65549, 131072, 4, 13, 131072, 3, 12, 131072, 3, -65524, 131072, 3, -131060, 262144, 1, -131059, 262144, 1, -131058, 262144, 1, -65522, 262144, 1, 14, 262144, 1, 65550, 262144, 1, 131086, 262144, 1, -65523, 262144, 1, 65548, 131072, 3, 8, 262144, 1, 7, 262144, 1, 6, 262144, 1, 5, 262144, 1, 4, 262144, 1, 3, 131072, 3, 2, 131072, 3, 1, 131072, 3, 0, 131072, 3, 65535, 262144, 1, 65534, 262144, 1, 65533, 262144, 1, -3, 262144, 1, -2, 262144, 1, -1, 262144, 1, -65536, 262144, 1, -65535, 262144, 1, -65534, 262144, 1, 65538, 262144, 1, 65537, 131072, 3, 65536, 131072, 3, 131071, 262144, 1, 131070, 262144, 1, 131069, 262144, 1, 720889, 196608, 0, 786425, 196608, 1, 851961, 196608, 1, 917497, 196608, 1, 983033, 196608, 1, 1048569, 196608, 2, 720890, 262144, 0, 1048570, 262144, 2, 720891, 262144, 0, 1048571, 262144, 2, -65540, 196608, 0, -4, 196608, 1, 65532, 196608, 1, 131068, 196608, 1, 196604, 196608, 2, 458748, 196608, 0, 524284, 196608, 1, 589820, 196608, 1, 655356, 196608, 1, 720892, 65536, 4, 1048572, 65536, 3, 1114108, 196608, 1, 1179644, 196608, 1, 1245180, 196608, 2, -65539, 262144, 0, 196605, 262144, 2, 458749, 262144, 0, 1245181, 262144, 2, -65538, 262144, 0, 196606, 262144, 2, 458750, 262144, 0, 1245182, 65536, 3, 1310718, 196608, 1, 1376254, 196608, 1, 1441790, 196608, 1, 1507326, 196608, 2, -65537, 262144, 0, 196607, 262144, 2, 458751, 262144, 0, 1507327, 262144, 2, -131072, 262144, 0, 131072, 262144, 2, 393216, 262144, 0, 1441792, 262144, 2, -131071, 262144, 0, 131073, 262144, 2, 393217, 262144, 0, 720897, 0, 3, 786433, 327680, 1, 851969, 327680, 1, 917505, 327680, 1, 983041, 327680, 1, 1048577, 0, 4, 1441793, 262144, 2, -131070, 262144, 0, 131074, 262144, 2, 393218, 262144, 0, 720898, 262144, 2, 1048578, 262144, 0, 1441794, 262144, 2, -131069, 327680, 0, -65533, 0, 4, 65539, 0, 3, 131075, 327680, 2, 327683, 196608, 0, 393219, 65536, 4, 720899, 65536, 3, 786435, 196608, 2, 1048579, 262144, 0, 1441795, 262144, 2, -65532, 262144, 0, 65540, 262144, 2, 327684, 262144, 0, 786436, 262144, 2, 1048580, 262144, 0, 1441796, 262144, 2, -65531, 262144, 0, 65541, 262144, 2, 327685, 262144, 0, 786437, 262144, 2, 1048581, 262144, 0, 1441797, 262144, 2, -65530, 262144, 0, 65542, 262144, 2, 327686, 262144, 0, 786438, 65536, 3, 851974, 196608, 1, 917510, 196608, 2, 1048582, 262144, 0, 1441798, 262144, 2, -65529, 262144, 0, 65543, 262144, 2, 327687, 262144, 0, 917511, 262144, 2, 1048583, 262144, 0, 1441799, 65536, 3, -196600, 196608, 0, -131064, 196608, 1, -65528, 65536, 4, 65544, 262144, 2, 327688, 262144, 0, 917512, 262144, 2, 1048584, 262144, 0, 1441800, 262144, 1, -196599, 262144, 0, 65545, 262144, 2, 327689, 262144, 0, 917513, 262144, 2, 1048585, 262144, 0, 1441801, 262144, 1, -196598, 262144, 0, 65546, 65536, 3, 131082, 196608, 1, 196618, 196608, 1, 262154, 196608, 1, 327690, 65536, 4, 917514, 262144, 2, 1048586, 262144, 0, 1441802, 262144, 1, -196597, 262144, 0, 917515, 262144, 2, 1048587, 262144, 0, 1441803, 262144, 1, -196596, 262144, 0, 917516, 262144, 2, 1048588, 327680, 0, 1114124, 327680, 1, 1179660, 327680, 1, 1245196, 327680, 1, 1310732, 327680, 1, 1376268, 0, 4, 1441804, 262144, 1, -196595, 262144, 0, 458765, 0, 3, 524301, 327680, 1, 589837, 327680, 1, 655373, 0, 4, 917517, 262144, 2, -196594, 262144, 0, 458766, 262144, 2, 655374, 262144, 0, 917518, 262144, 2, -196593, 327680, 0, -131057, 327680, 1, -65521, 327680, 1, 15, 0, 4, 65551, 262144, 1, 131087, 262144, 1, 196623, 262144, 1, 327695, 262144, 1, 393231, 0, 3, 458767, 327680, 2, 655375, 327680, 0, 720911, 327680, 1, 786447, 327680, 1, 851983, 327680, 1, 917519, 327680, 2, 262159, 262144, 1, 262158, 262144, 1, 327693, 262144, 1, 393228, 262144, 1, 458763, 262144, 1, 458762, 262144, 1, 458761, 262144, 1, 524296, 131072, 3, 524295, 131072, 3, 589831, 131072, 3, 589830, 131072, 3, 655365, 262144, 1, 851989, 262144, 1, 917525, 262144, 1, 983061, 262144, 1, 1048597, 262144, 1, 1114133, 262144, 1, 1179669, 262144, 1, 1245205, 262144, 1, 1310741, 262144, 1, 1376277, 262144, 1, 1441813, 262144, 1, 1507349, 262144, 1, 1572885, 262144, 1, 1638421, 262144, 1, 851990, 262144, 1, 917526, 262144, 1, 983062, 262144, 1, 1048598, 262144, 1, 1114134, 262144, 1, 1179670, 262144, 1, 1245206, 262144, 1, 1310742, 262144, 1, 1376278, 262144, 1, 1441814, 262144, 1, 1507350, 262144, 1, 1572886, 262144, 1, 1638422, 262144, 1, 851991, 262144, 1, 917527, 262144, 1, 983063, 262144, 1, 1048599, 262144, 1, 1114135, 262144, 1, 1179671, 262144, 1, 1245207, 262144, 1, 1310743, 262144, 1, 1376279, 262144, 1, 1441815, 262144, 1, 1507351, 262144, 1, 1572887, 262144, 1, 1638423, 262144, 1, 851992, 262144, 1, 917528, 262144, 1, 983064, 262144, 1, 1048600, 262144, 1, 1114136, 262144, 1, 1179672, 262144, 1, 1245208, 262144, 1, 1310744, 262144, 1, 1376280, 262144, 1, 1441816, 262144, 1, 1507352, 262144, 1, 1572888, 262144, 1, 1638424, 262144, 1, 851993, 262144, 1, 917529, 262144, 1, 983065, 262144, 1, 1048601, 262144, 1, 1114137, 262144, 1, 1179673, 262144, 1, 1245209, 262144, 1, 1310745, 262144, 1, 1376281, 262144, 1, 1441817, 262144, 1, 1507353, 262144, 1, 1572889, 262144, 1, 1638425, 262144, 1, 851994, 262144, 1, 917530, 262144, 1, 983066, 262144, 1, 1048602, 262144, 1, 1114138, 262144, 1, 1179674, 262144, 1, 1245210, 262144, 1, 1310746, 262144, 1, 1376282, 262144, 1, 1441818, 262144, 1, 1507354, 262144, 1, 1572890, 262144, 1, 1638426, 262144, 1, 851995, 262144, 1, 917531, 262144, 1, 983067, 262144, 1, 1048603, 262144, 1, 1114139, 262144, 1, 1179675, 262144, 1, 1245211, 262144, 1, 1310747, 262144, 1, 1376283, 262144, 1, 1441819, 262144, 1, 1507355, 262144, 1, 1572891, 262144, 1, 1638427, 262144, 1, 851996, 262144, 1, 917532, 262144, 1, 983068, 262144, 1, 1048604, 262144, 1, 1114140, 262144, 1, 1179676, 262144, 1, 1245212, 262144, 1, 1310748, 262144, 1, 1376284, 262144, 1, 1441820, 262144, 1, 1507356, 262144, 1, 1572892, 262144, 1, 1638428, 262144, 1, 65555, 262144, 1, 131091, 262144, 1, 196627, 262144, 1, 262163, 262144, 1, 327699, 262144, 1, 65556, 262144, 1, 131092, 262144, 1, 196628, 262144, 1, 262164, 262144, 1, 327700, 262144, 1, 65557, 262144, 1, 131093, 262144, 1, 196629, 262144, 1, 262165, 262144, 1, 327701, 262144, 1, 65558, 262144, 1, 131094, 262144, 1, 196630, 262144, 1, 262166, 262144, 1, 327702, 262144, 1, 65559, 262144, 1, 131095, 262144, 1, 196631, 262144, 1, 262167, 262144, 1, 327703, 262144, 1, 65560, 262144, 1, 131096, 262144, 1, 196632, 262144, 1, 262168, 262144, 1, 327704, 262144, 1, 65561, 262144, 1, 131097, 262144, 1, 196633, 262144, 1, 262169, 262144, 1, 327705, 262144, 1, 393237, 262144, 1, 458773, 262144, 1, 524309, 262144, 1, 589845, 262144, 1, 655381, 262144, 1, 720917, 262144, 1, 786453, 262144, 1, 393238, 262144, 1, 458774, 262144, 1, 524310, 262144, 1, 589846, 262144, 1, 655382, 262144, 1, 720918, 262144, 1, 786454, 262144, 1, 393239, 262144, 1, 458775, 262144, 1, 524311, 262144, 1, 589847, 262144, 1, 655383, 262144, 1, 720919, 262144, 1, 786455, 262144, 1, 393240, 262144, 1, 458776, 262144, 1, 524312, 262144, 1, 589848, 262144, 1, 655384, 262144, 1, 720920, 262144, 1, 786456, 262144, 1, 393241, 262144, 1, 458777, 262144, 1, 524313, 262144, 1, 589849, 262144, 1, 655385, 262144, 1, 720921, 262144, 1, 786457, 262144, 1, 65552, 262144, 1, 131088, 262144, 1, 196624, 262144, 1, 262160, 262144, 1, 327696, 262144, 1, 65553, 262144, 1, 131089, 262144, 1, 196625, 262144, 1, 262161, 262144, 1, 327697, 262144, 1, 65554, 262144, 1, 131090, 262144, 1, 196626, 262144, 1, 262162, 262144, 1, 327698, 262144, 1, 1507336, 262144, 1, 1572872, 262144, 1, 1638408, 262144, 1, 1507337, 262144, 1, 1572873, 262144, 1, 1638409, 262144, 1, 1507338, 262144, 1, 1572874, 262144, 1, 1638410, 262144, 1, 1507339, 262144, 1, 1572875, 262144, 1, 1638411, 262144, 1, 1507340, 262144, 1, 1572876, 262144, 1, 1638412, 262144, 1, 1441805, 262144, 1, 1507341, 262144, 1, 1572877, 262144, 1, 1638413, 262144, 1, 1441806, 262144, 1, 1507342, 262144, 1, 1572878, 262144, 1, 1638414, 262144, 1, 1441807, 262144, 1, 1507343, 262144, 1, 1572879, 262144, 1, 1638415, 262144, 1, 1441808, 262144, 1, 1507344, 262144, 1, 1572880, 262144, 1, 1638416, 262144, 1, 1441809, 262144, 1, 1507345, 262144, 1, 1572881, 262144, 1, 1638417, 262144, 1, 1441810, 262144, 1, 1507346, 262144, 1, 1572882, 262144, 1, 1638418, 262144, 1, 1441811, 262144, 1, 1507347, 262144, 1, 1572883, 262144, 1, 1638419, 262144, 1, 1441812, 262144, 1, 1507348, 262144, 1, 1572884, 262144, 1, 1638420, 262144, 1, 1507335, 196608, 1, 1572871, 196608, 1, 1638407, 196608, 1, 1703944, 262144, 2, 1703945, 262144, 2, 1703946, 65536, 3, 1703947, 262144, 1, 1703948, 262144, 1, 1703949, 262144, 1, 1703950, 262144, 1, 1703951, 262144, 1, 1703952, 262144, 1, 1703953, 262144, 1, 1703954, 262144, 1, 1703955, 262144, 1, 1703956, 262144, 1, 1703957, 262144, 1, 1703958, 262144, 1, 1703959, 262144, 1, 1703960, 262144, 1, 1703961, 262144, 1, 1703962, 0, 3, 1703963, 262144, 2, 1703964, 262144, 2, 1703965, 327680, 2, 1114141, 327680, 1, 1179677, 327680, 1, 1245213, 327680, 1, 1310749, 327680, 1, 1376285, 327680, 1, 1441821, 327680, 1, 1507357, 327680, 1, 1572893, 327680, 1, 1638429, 327680, 1, 851997, 327680, 1, 917533, 327680, 1, 983069, 327680, 1, 1048605, 327680, 1, 65562, 327680, 1, 131098, 327680, 1, 196634, 327680, 1, 262170, 327680, 1, 327706, 327680, 1, 393242, 327680, 1, 458778, 327680, 1, 524314, 327680, 1, 589850, 327680, 1, 655386, 327680, 1, 720922, 327680, 1, 786458, 0, 4, 786459, 262144, 0, 786460, 262144, 0, 786461, 327680, 0, 16, 262144, 0, 17, 262144, 0, 18, 262144, 0, 19, 262144, 0, 20, 262144, 0, 21, 262144, 0, 22, 262144, 0, 23, 262144, 0, 24, 262144, 0, 25, 262144, 0, 26, 327680, 0, 393236, 65536, 3, 393232, 262144, 2, 393233, 262144, 2, 393234, 262144, 2, 393235, 262144, 2, 458772, 196608, 1, 524308, 196608, 1, 589844, 196608, 1, 655380, 196608, 1, 720916, 196608, 1, 786452, 196608, 1, 851988, 196608, 1, 917524, 196608, 1, 983060, 196608, 1, 1048596, 196608, 1, 1114132, 196608, 1, 1179668, 196608, 1, 1245204, 196608, 1, 1310740, 196608, 1, 1376276, 65536, 4, 1376269, 262144, 0, 1376270, 262144, 0, 1376271, 262144, 0, 1376272, 262144, 0, 1376273, 262144, 0, 1376274, 262144, 0, 1376275, 262144, 0, 1769484, 262144, 1, 1769485, 262144, 1, 1769486, 262144, 1, 1769487, 262144, 1, 1769488, 262144, 1, 1769489, 262144, 1, 1769490, 262144, 1, 1769491, 262144, 1, 1769492, 262144, 1, 1769493, 262144, 1, 1769494, 262144, 1, 1835022, 262144, 1, 1835023, 262144, 1, 1835024, 262144, 1, 1835025, 262144, 1, 1769483, 65536, 3, 1835021, 65536, 3, 1835026, 0, 3, 1769495, 0, 3, 1900562, 262144, 1, 1835031, 327680, 2, 1900557, 262144, 1, 1835019, 196608, 2, 1769482, 196608, 2, 1835020, 262144, 2, 1900560, 262144, 1, 1900561, 262144, 1, 1835027, 262144, 2, 1835028, 262144, 2, 1835029, 262144, 2, 1835030, 262144, 2, 1769496, 262144, 2, 1769497, 262144, 2, 1769498, 327680, 2, 1835016, 262144, 0, 1835017, 262144, 0, 1835018, 262144, 0, 1900552, 262144, 1, 1900553, 262144, 1, 1900554, 262144, 1, 1900555, 262144, 1, 1900556, 262144, 1, 1966088, 262144, 1, 1966089, 262144, 1, 1966090, 262144, 1, 1966091, 262144, 1, 1966092, 262144, 1, 1966093, 262144, 1, 1966094, 262144, 1, 1966095, 262144, 1, 1966096, 262144, 1, 1966097, 262144, 1, 1966098, 262144, 1, 1966099, 262144, 1, 1966100, 262144, 1, 1966101, 262144, 1, 1900563, 262144, 1, 1900564, 262144, 1, 1900565, 262144, 1, 1900566, 262144, 1, 1900567, 262144, 1, 1966102, 262144, 1, 1966103, 262144, 1, 1835032, 262144, 1, 1900568, 262144, 1, 1966104, 262144, 1, 2031626, 262144, 1, 2031627, 262144, 1, 2031628, 262144, 1, 2031629, 262144, 1, 2031630, 262144, 1, 2031631, 262144, 1, 2031632, 262144, 1, 2031633, 262144, 1, 2031634, 262144, 1, 2031635, 262144, 1, 2031636, 262144, 1, 2097172, 262144, 1, 2097171, 262144, 1, 2097170, 262144, 1, 2097169, 262144, 1, 2097168, 262144, 1, 2097167, 262144, 1, 2097166, 262144, 1, 2097165, 262144, 1, 2097164, 262144, 1, 2097163, 262144, 1, 2097162, 262144, 1, 2031637, 262144, 1, 2097173, 262144, 1, 2097174, 262144, 1, 2031638, 262144, 1, 2031639, 262144, 1, 2097175, 262144, 1, 2097176, 262144, 1, 2031640, 262144, 1, 2162699, 262144, 1, 2162700, 262144, 1, 2162701, 262144, 1, 2162702, 262144, 1, 2162703, 262144, 1, 2162704, 262144, 1, 2162705, 262144, 1, 2162709, 262144, 1, 2162710, 262144, 1, 2162711, 262144, 1, 2162708, 262144, 1, 2162707, 262144, 1, 2162706, 262144, 1, 2162698, 262144, 1, 2228234, 262144, 1, 2228235, 262144, 1, 2228236, 262144, 1, 2228237, 262144, 1, 2228238, 262144, 1, 2228239, 262144, 1, 2228240, 262144, 1, 2228241, 262144, 1, 2228242, 262144, 1, 2228243, 262144, 1, 2228244, 262144, 1, 2228245, 262144, 1, 2228246, 262144, 1, 2228247, 262144, 1, 2293769, 196608, 2, 2031623, 196608, 2, 2293784, 327680, 2, 2162713, 327680, 2, 1835033, 327680, 1, 1900569, 327680, 1, 1966105, 327680, 1, 2031641, 327680, 1, 2097177, 327680, 1, 2162712, 0, 3, 2031625, 65536, 3, 2031624, 262144, 2, 2097161, 196608, 1, 2162697, 196608, 1, 2228233, 196608, 1, 2293770, 262144, 2, 2293771, 262144, 2, 2293772, 262144, 2, 2293773, 262144, 2, 2293774, 262144, 2, 2293775, 262144, 2, 2293776, 262144, 2, 2293777, 262144, 2, 2293778, 262144, 2, 2293779, 262144, 2, 2293780, 262144, 2, 2293781, 262144, 2, 2293782, 262144, 2, 2293783, 262144, 2, 2228248, 327680, 1, 1966087, 196608, 1, 1900551, 196608, 1, 1835015, 196608, 0, 1703943, 196608, 2, 1900559, 262144, 1, 1900558, 262144, 1) @@ -252,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_qliqj") +material = SubResource("ShaderMaterial_3sxqg") position = Vector2(169, 115) [node name="ExampleEnemy2" parent="Entities" index="1" instance=ExtResource("3_hwof6")] -material = SubResource("ShaderMaterial_xpy5p") +material = SubResource("ShaderMaterial_r3w8l") position = Vector2(75, 130) [node name="ExampleEnemy3" parent="Entities" index="2" instance=ExtResource("3_hwof6")] -material = SubResource("ShaderMaterial_jlmdb") +material = SubResource("ShaderMaterial_2oi7o") position = Vector2(140, 177) [node name="ExampleEnemy4" parent="Entities" index="3" instance=ExtResource("3_hwof6")] -material = SubResource("ShaderMaterial_pd2a6") +material = SubResource("ShaderMaterial_65pfr") position = Vector2(14, 159) [node name="ExampleEnemy5" parent="Entities" index="4" instance=ExtResource("3_hwof6")] -material = SubResource("ShaderMaterial_th2v6") +material = SubResource("ShaderMaterial_5a7w6") position = Vector2(10, 22) Faction = 1 @@ -286,5 +302,9 @@ SpawnTime = 5.0 [node name="CollisionShape2D" parent="Spawners/Spawner/Area2D" index="0"] shape = SubResource("RectangleShape2D_oods2") +[node name="WorldEnvironment" parent="." index="5"] +environment = SubResource("Environment_c0b2h") + [editable path="Entities/Campfire"] +[editable path="Entities/Campfire/InteractionTrigger"] [editable path="Spawners/Spawner"] diff --git a/State/Character/CharacterState.cs b/State/Character/CharacterState.cs index 08fc94e..7632a4a 100644 --- a/State/Character/CharacterState.cs +++ b/State/Character/CharacterState.cs @@ -46,6 +46,13 @@ public abstract partial class CharacterState : Node, IState public virtual CharacterState PhysicsProcess(double delta) { + if (Character.Health < 0) + { + Character.Velocity = Vector2.Zero; + Character.MoveAndSlide(); + return null; + } + Character.Velocity = Character.NetImpulse; if (Character.NetImpulse.LengthSquared() < Mathf.Pow(Character.Speed, 2)) diff --git a/State/Character/PlayerRollState.cs b/State/Character/PlayerRollState.cs index d5a3acd..4c0ddbc 100644 --- a/State/Character/PlayerRollState.cs +++ b/State/Character/PlayerRollState.cs @@ -46,7 +46,7 @@ public partial class PlayerRollState : PlayerState public override CharacterState Process(double delta) { Character.Direction = _rollDirection; - if ((_timeLeftToRoll -= delta) <= 0) + if ((_timeLeftToRoll -= delta) <= 0 || _player.Health <= 0) { return IdleState; } diff --git a/SupaLidlGame.csproj b/SupaLidlGame.csproj index e7f1627..44aa4a6 100644 --- a/SupaLidlGame.csproj +++ b/SupaLidlGame.csproj @@ -1,4 +1,4 @@ - + net6.0 true diff --git a/Utils/Spawner.cs b/Utils/Spawner.cs index 0d642ca..07a5351 100644 --- a/Utils/Spawner.cs +++ b/Utils/Spawner.cs @@ -1,5 +1,6 @@ using Godot; using Godot.Collections; +using GodotUtilities; using SupaLidlGame.Extensions; namespace SupaLidlGame.Utils; diff --git a/Utils/World.cs b/Utils/World.cs index 68c61c0..8e426d7 100644 --- a/Utils/World.cs +++ b/Utils/World.cs @@ -49,7 +49,10 @@ public partial class World : Node2D CurrentPlayer.Death += (Events.HealthChangedArgs args) => { // TODO: respawn the player at the last campfire. - SpawnPlayer(); + GetTree().CreateTimer(1).Timeout += () => + { + SpawnPlayer(); + }; }; base._Ready(); @@ -200,11 +203,13 @@ public partial class World : Node2D public void SpawnPlayer() { // TODO: add max health property - CurrentPlayer.Health = 100; - CurrentPlayer.GlobalPosition = SaveLocation; + //CurrentPlayer.Health = 100; + //CurrentPlayer.Sprite.Visible = true; if (CurrentMap.SceneFilePath != SaveMapKey) { LoadScene(SaveMapKey); } + CurrentPlayer.GlobalPosition = SaveLocation; + CurrentPlayer.Spawn(); } } diff --git a/project.godot b/project.godot index 8bdfda5..e28b7f9 100644 --- a/project.godot +++ b/project.godot @@ -47,13 +47,13 @@ ui_down={ } roll={ "deadzone": 0.5, -"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":3,"pressed":false,"double_click":false,"script":null) +"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":3,"canceled":false,"pressed":false,"double_click":false,"script":null) , Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":0,"echo":false,"script":null) ] } attack1={ "deadzone": 0.5, -"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"pressed":false,"double_click":false,"script":null) +"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"canceled":false,"pressed":false,"double_click":false,"script":null) ] } equip={