diff --git a/.idea/.idea.Cirno/.idea/.gitignore b/.idea/.idea.Cirno/.idea/.gitignore new file mode 100644 index 00000000..a1465466 --- /dev/null +++ b/.idea/.idea.Cirno/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/modules.xml +/projectSettingsUpdater.xml +/contentModel.xml +/.idea.Cirno.iml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/.idea.Cirno/.idea/.name b/.idea/.idea.Cirno/.idea/.name new file mode 100644 index 00000000..47af11cf --- /dev/null +++ b/.idea/.idea.Cirno/.idea/.name @@ -0,0 +1 @@ +Cirno \ No newline at end of file diff --git a/.idea/.idea.Cirno/.idea/encodings.xml b/.idea/.idea.Cirno/.idea/encodings.xml new file mode 100644 index 00000000..df87cf95 --- /dev/null +++ b/.idea/.idea.Cirno/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/.idea.Cirno/.idea/indexLayout.xml b/.idea/.idea.Cirno/.idea/indexLayout.xml new file mode 100644 index 00000000..7b08163c --- /dev/null +++ b/.idea/.idea.Cirno/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.Cirno/.idea/vcs.xml b/.idea/.idea.Cirno/.idea/vcs.xml new file mode 100644 index 00000000..35eb1ddf --- /dev/null +++ b/.idea/.idea.Cirno/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Scenes/Barrel.cs b/Scenes/Barrel.cs index 1e45f9f8..160e7aaf 100644 --- a/Scenes/Barrel.cs +++ b/Scenes/Barrel.cs @@ -4,12 +4,13 @@ using System.Diagnostics; public partial class Barrel : Area2D, IDestructible { + [Export] public float Health = 1f; - [Export] - public float Health = 1f; + [Export] public float ExplosionRadius = 1; - [Export] - public float ExplosionRadius = 1; + [Export] public float ExplosionDamage = 1; + + [Export] public PackedScene DebrisScene { get; set; } private float _currentHealth; @@ -26,23 +27,34 @@ public partial class Barrel : Area2D, IDestructible { } - public void Explode() { + private void Explode() + { Debug.WriteLine("Boom"); + CreateDebris(); QueueFree(); } + private void CreateDebris() + { + if (DebrisScene == null) return; + var debris = DebrisScene.Instantiate(); + Owner.AddChild(debris); + debris.Transform = this.GlobalTransform; + debris.Position = this.Position; + } + public void Hit(float damage) { if (_isDestroyed) return; + + _currentHealth -= damage; + if (!(_currentHealth <= 0)) return; _isDestroyed = true; Explode(); - - // TODO: Change sprite } public bool IsDestroyed() { return _isDestroyed; } - } diff --git a/Scenes/Barrel.tscn b/Scenes/Barrel.tscn index b64fa115..e3271152 100644 --- a/Scenes/Barrel.tscn +++ b/Scenes/Barrel.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=6 format=3 uid="uid://bj28qiai2x2ar"] +[gd_scene load_steps=7 format=3 uid="uid://bj28qiai2x2ar"] [ext_resource type="Script" path="res://Scenes/Barrel.cs" id="1_avwdx"] [ext_resource type="Texture2D" uid="uid://d2f16ke8c7vwx" path="res://Sprites/Barrel.png" id="1_e66t6"] +[ext_resource type="PackedScene" uid="uid://clyyl3jgpfoo7" path="res://Scenes/Broken_Barrel.tscn" id="2_f145b"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_2ewfl"] size = Vector2(11, 14) @@ -17,6 +18,10 @@ size = Vector2(11, 14) collision_layer = 64 collision_mask = 10 script = ExtResource("1_avwdx") +Health = 2.0 +ExplosionRadius = 2.0 +ExplosionDamage = 2.0 +DebrisScene = ExtResource("2_f145b") metadata/_edit_group_ = true [node name="CollisionShape2D" type="CollisionShape2D" parent="."] diff --git a/Scenes/Box_Red.tscn b/Scenes/Box_Red.tscn index a1ca9236..aa047c52 100644 --- a/Scenes/Box_Red.tscn +++ b/Scenes/Box_Red.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=5 format=3 uid="uid://bgk7fgwiis425"] +[gd_scene load_steps=6 format=3 uid="uid://bgk7fgwiis425"] [ext_resource type="Script" path="res://Scenes/Barrel.cs" id="1_flhlf"] +[ext_resource type="PackedScene" uid="uid://dpaobtgb3l4ft" path="res://Scenes/Box_Red_Broken.tscn" id="2_baxfl"] [ext_resource type="Texture2D" uid="uid://c1djpk8lbgjfe" path="res://Sprites/Box_Red.png" id="2_g1pum"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_2ewfl"] @@ -9,10 +10,14 @@ size = Vector2(11, 14) [sub_resource type="RectangleShape2D" id="RectangleShape2D_ss2y0"] size = Vector2(11, 14) -[node name="Barrel" type="Area2D" groups=["Destroyable"]] +[node name="Red Box" type="Area2D" groups=["Destroyable"]] collision_layer = 64 collision_mask = 10 script = ExtResource("1_flhlf") +Health = 4.0 +ExplosionRadius = 0.0 +ExplosionDamage = 0.0 +DebrisScene = ExtResource("2_baxfl") metadata/_edit_group_ = true [node name="CollisionShape2D" type="CollisionShape2D" parent="."] diff --git a/Scenes/Box_Red_Broken.tscn b/Scenes/Box_Red_Broken.tscn new file mode 100644 index 00000000..5d13c05e --- /dev/null +++ b/Scenes/Box_Red_Broken.tscn @@ -0,0 +1,37 @@ +[gd_scene load_steps=5 format=3 uid="uid://dpaobtgb3l4ft"] + +[ext_resource type="Script" path="res://Scenes/Barrel.cs" id="1_bmfxn"] +[ext_resource type="Texture2D" uid="uid://cs07w6ekvoyog" path="res://Sprites/Box_Red_Broken.png" id="2_j8sot"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_2ewfl"] +size = Vector2(11, 14) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_ss2y0"] +size = Vector2(11, 14) + +[node name="Red Box" type="Area2D" groups=["Destroyable"]] +collision_layer = 64 +collision_mask = 10 +script = ExtResource("1_bmfxn") +Health = 2.0 +ExplosionRadius = 0.0 +ExplosionDamage = 0.0 +metadata/_edit_group_ = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +visible = false +position = Vector2(0.5, -1) +shape = SubResource("RectangleShape2D_2ewfl") + +[node name="Sprite2D" type="Sprite2D" parent="."] +texture = ExtResource("2_j8sot") + +[node name="RigidBody2D" type="RigidBody2D" parent="."] +collision_layer = 64 +collision_mask = 10 +gravity_scale = 0.0 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D"] +visible = false +position = Vector2(0.5, -1) +shape = SubResource("RectangleShape2D_ss2y0") diff --git a/Scenes/Broken_Barrel.tscn b/Scenes/Broken_Barrel.tscn new file mode 100644 index 00000000..c7215955 --- /dev/null +++ b/Scenes/Broken_Barrel.tscn @@ -0,0 +1,41 @@ +[gd_scene load_steps=6 format=3 uid="uid://clyyl3jgpfoo7"] + +[ext_resource type="Script" path="res://Scenes/Barrel.cs" id="1_gn5xq"] +[ext_resource type="Texture2D" uid="uid://d2f16ke8c7vwx" path="res://Sprites/Barrel.png" id="3_c3t2t"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_2ewfl"] +size = Vector2(11, 14) + +[sub_resource type="AtlasTexture" id="AtlasTexture_v7gy8"] +atlas = ExtResource("3_c3t2t") +region = Rect2(16, 0, 16, 16) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_ss2y0"] +size = Vector2(11, 14) + +[node name="Barrel" type="Area2D" groups=["Destroyable"]] +collision_layer = 64 +collision_mask = 10 +script = ExtResource("1_gn5xq") +Health = 2.0 +ExplosionRadius = 0.0 +ExplosionDamage = 0.0 +metadata/_edit_group_ = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +visible = false +position = Vector2(0.5, -1) +shape = SubResource("RectangleShape2D_2ewfl") + +[node name="Sprite2D" type="Sprite2D" parent="."] +texture = SubResource("AtlasTexture_v7gy8") + +[node name="RigidBody2D" type="RigidBody2D" parent="."] +collision_layer = 64 +collision_mask = 10 +gravity_scale = 0.0 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D"] +visible = false +position = Vector2(0.5, -1) +shape = SubResource("RectangleShape2D_ss2y0") diff --git a/Scenes/Explosion.tscn b/Scenes/Explosion.tscn new file mode 100644 index 00000000..59dbdb41 --- /dev/null +++ b/Scenes/Explosion.tscn @@ -0,0 +1,30 @@ +[gd_scene load_steps=6 format=3 uid="uid://jmijre3eaf8m"] + +[sub_resource type="Gradient" id="Gradient_417ds"] +colors = PackedColorArray(0.90732, 0.880677, 0.238848, 1, 1, 0.223786, 0.223786, 1) + +[sub_resource type="GradientTexture1D" id="GradientTexture1D_b2evf"] +gradient = SubResource("Gradient_417ds") + +[sub_resource type="Curve" id="Curve_xis5v"] +_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 0.340659), 0.0, 0.0, 0, 0] +point_count = 2 + +[sub_resource type="CurveTexture" id="CurveTexture_y21cl"] +curve = SubResource("Curve_xis5v") + +[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_4vw6r"] +particle_flag_disable_z = true +spread = 180.0 +initial_velocity_min = 30.0 +initial_velocity_max = 75.0 +gravity = Vector3(0, 0, 0) +damping_min = 28.0 +damping_max = 28.0 +scale_curve = SubResource("CurveTexture_y21cl") +color_ramp = SubResource("GradientTexture1D_b2evf") + +[node name="Explosion" type="GPUParticles2D"] +amount = 20 +process_material = SubResource("ParticleProcessMaterial_4vw6r") +explosiveness = 1.0 diff --git a/Scenes/Flame.tscn b/Scenes/Flame.tscn new file mode 100644 index 00000000..cf867442 --- /dev/null +++ b/Scenes/Flame.tscn @@ -0,0 +1,29 @@ +[gd_scene load_steps=6 format=3 uid="uid://crf8u0wylcgob"] + +[sub_resource type="Gradient" id="Gradient_rdypf"] +offsets = PackedFloat32Array(0, 0.5, 1) +colors = PackedColorArray(0.961629, 0.709712, 0.208875, 1, 0.920897, 0.430377, 0.230309, 1, 1, 1, 1, 0.568627) + +[sub_resource type="GradientTexture1D" id="GradientTexture1D_tkcjt"] +gradient = SubResource("Gradient_rdypf") + +[sub_resource type="Curve" id="Curve_ar4pe"] +_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] +point_count = 2 + +[sub_resource type="CurveTexture" id="CurveTexture_2gmgs"] +curve = SubResource("Curve_ar4pe") + +[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_8rmhf"] +particle_flag_disable_z = true +gravity = Vector3(0, -98, 0) +scale_min = 2.0 +scale_max = 2.0 +scale_curve = SubResource("CurveTexture_2gmgs") +color_ramp = SubResource("GradientTexture1D_tkcjt") +turbulence_enabled = true +turbulence_noise_scale = 1.08 + +[node name="Flame" type="GPUParticles2D"] +amount = 50 +process_material = SubResource("ParticleProcessMaterial_8rmhf") diff --git a/Scenes/Smoke.tscn b/Scenes/Smoke.tscn new file mode 100644 index 00000000..b73b6a83 --- /dev/null +++ b/Scenes/Smoke.tscn @@ -0,0 +1,34 @@ +[gd_scene load_steps=7 format=3 uid="uid://cdvk0ifhabrms"] + +[ext_resource type="Texture2D" uid="uid://d0gbsrene2hqu" path="res://Sprites/Smoke.png" id="1_mprmi"] + +[sub_resource type="Gradient" id="Gradient_puegb"] +colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 0) + +[sub_resource type="GradientTexture1D" id="GradientTexture1D_pv7nn"] +gradient = SubResource("Gradient_puegb") + +[sub_resource type="Curve" id="Curve_00di7"] +_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] +point_count = 2 + +[sub_resource type="CurveTexture" id="CurveTexture_ga0hc"] +curve = SubResource("Curve_00di7") + +[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_kuwpg"] +particle_flag_disable_z = true +spread = 180.0 +initial_velocity_min = 25.0 +initial_velocity_max = 75.0 +gravity = Vector3(0, 0, 0) +damping_min = 28.0 +damping_max = 28.0 +scale_curve = SubResource("CurveTexture_ga0hc") +color_ramp = SubResource("GradientTexture1D_pv7nn") +turbulence_enabled = true + +[node name="Smoke" type="GPUParticles2D"] +amount = 30 +process_material = SubResource("ParticleProcessMaterial_kuwpg") +texture = ExtResource("1_mprmi") +explosiveness = 1.0 diff --git a/Scenes/test.tscn b/Scenes/test.tscn index 8e98a986..484c6ccb 100644 --- a/Scenes/test.tscn +++ b/Scenes/test.tscn @@ -6952,15 +6952,12 @@ layer_2/tile_data = PackedInt32Array(-852021, 131072, 6, -786485, 131072, 6, -72 [node name="Barrel" parent="Factory Tilemaps/Solid" instance=ExtResource("5_3uba3")] position = Vector2(-751, -166) -Health = 2.0 [node name="Barrel2" parent="Factory Tilemaps/Solid" instance=ExtResource("5_3uba3")] position = Vector2(-615, -103) -Health = 2.0 [node name="Barrel3" parent="Factory Tilemaps/Solid" instance=ExtResource("5_3uba3")] position = Vector2(-631, -103) -Health = 2.0 [node name="LargeTank" parent="Factory Tilemaps/Solid" instance=ExtResource("6_nkauc")] position = Vector2(-639, 71) diff --git a/Scripts/PlayerMovement.cs b/Scripts/PlayerMovement.cs index dfa9d4cb..814be691 100644 --- a/Scripts/PlayerMovement.cs +++ b/Scripts/PlayerMovement.cs @@ -53,16 +53,13 @@ public partial class PlayerMovement : CharacterBody2D private void HandleShoot() { - if (Input.IsActionJustPressed("shoot")) - { - //Debug.WriteLine("Shoot"); - Bullet bullet = BulletScene.Instantiate(); - Owner.AddChild(bullet); - bullet.Transform = Muzzle.GlobalTransform; - bullet.Position = this.Position; - bullet.SetDirection(this._facingDirection); - - } + if (!Input.IsActionJustPressed("shoot")) return; + //Debug.WriteLine("Shoot"); + var bullet = BulletScene.Instantiate(); + Owner.AddChild(bullet); + bullet.Transform = Muzzle.GlobalTransform; + bullet.Position = this.Position; + bullet.SetDirection(this._facingDirection); } private void SetAnimation() diff --git a/Sprites/Box_Red_Broken.aseprite b/Sprites/Box_Red_Broken.aseprite new file mode 100644 index 00000000..d8aa92f0 --- /dev/null +++ b/Sprites/Box_Red_Broken.aseprite @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fb24e5bd22d8dd558a55ff5dc615ab9c3d78abe890662e5a21a2917a21a87f0b +size 453 diff --git a/Sprites/Box_Red_Broken.png b/Sprites/Box_Red_Broken.png new file mode 100644 index 00000000..c241d727 --- /dev/null +++ b/Sprites/Box_Red_Broken.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fc84b002f155b40538e1b4ac9db2b7ded5b80f47432bf1161d0bfc5f3cd0b53f +size 291 diff --git a/Sprites/Box_Red_Broken.png.import b/Sprites/Box_Red_Broken.png.import new file mode 100644 index 00000000..b7dff430 --- /dev/null +++ b/Sprites/Box_Red_Broken.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cs07w6ekvoyog" +path="res://.godot/imported/Box_Red_Broken.png-a1c26e614b54f2e861abdea687489d65.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Sprites/Box_Red_Broken.png" +dest_files=["res://.godot/imported/Box_Red_Broken.png-a1c26e614b54f2e861abdea687489d65.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/Sprites/Smoke.aseprite b/Sprites/Smoke.aseprite new file mode 100644 index 00000000..6d52c696 --- /dev/null +++ b/Sprites/Smoke.aseprite @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:12b2f09840015ad2c0235fc25a02ae82ff52d9bc1592febbf099df350e7ecb9a +size 369 diff --git a/Sprites/Smoke.png b/Sprites/Smoke.png new file mode 100644 index 00000000..85fc4a98 --- /dev/null +++ b/Sprites/Smoke.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b5bf87be743298bb1fbf1a413dfa89fbb90c6f32c8c63f124d78fd1409bfc2ff +size 131 diff --git a/Sprites/Smoke.png.import b/Sprites/Smoke.png.import new file mode 100644 index 00000000..74d72732 --- /dev/null +++ b/Sprites/Smoke.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://d0gbsrene2hqu" +path="res://.godot/imported/Smoke.png-5692449a3d406e5c061bff54037cb28a.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Sprites/Smoke.png" +dest_files=["res://.godot/imported/Smoke.png-5692449a3d406e5c061bff54037cb28a.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