From 04ea003b6de38c5b9d272edcfb05edabf4e4166d Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 3 Apr 2022 21:42:47 +0200 Subject: [PATCH] :boom: Improve `Fire` significantly --- src/entities/Fire.tscn | 22 ------------ src/entities/{ => fire}/Fire.gd | 2 +- src/entities/fire/Fire.tscn | 35 +++++++++++++++++++ src/entities/{ => fire}/FireConcept.png | 0 .../{ => fire}/FireConcept.png.import | 6 ++-- src/entities/{ => fire}/FireFlame.png | 0 src/entities/{ => fire}/FireFlame.png.import | 6 ++-- src/entities/{ => fire}/FirePit.png | 0 src/entities/{ => fire}/FirePit.png.import | 6 ++-- src/levels/Game.tscn | 2 +- 10 files changed, 46 insertions(+), 33 deletions(-) delete mode 100644 src/entities/Fire.tscn rename src/entities/{ => fire}/Fire.gd (97%) create mode 100644 src/entities/fire/Fire.tscn rename src/entities/{ => fire}/FireConcept.png (100%) rename src/entities/{ => fire}/FireConcept.png.import (70%) rename src/entities/{ => fire}/FireFlame.png (100%) rename src/entities/{ => fire}/FireFlame.png.import (70%) rename src/entities/{ => fire}/FirePit.png (100%) rename src/entities/{ => fire}/FirePit.png.import (72%) diff --git a/src/entities/Fire.tscn b/src/entities/Fire.tscn deleted file mode 100644 index 71b560b..0000000 --- a/src/entities/Fire.tscn +++ /dev/null @@ -1,22 +0,0 @@ -[gd_scene load_steps=5 format=2] - -[ext_resource path="res://src/mechanics/Light.png" type="Texture" id=1] -[ext_resource path="res://src/mechanics/White.png" type="Texture" id=2] -[ext_resource path="res://src/entities/Fire.gd" type="Script" id=3] - -[sub_resource type="RectangleShape2D" id=1] -extents = Vector2( 16, 16 ) - -[node name="Fire" type="StaticBody2D"] -script = ExtResource( 3 ) - -[node name="Shape" type="CollisionShape2D" parent="."] -shape = SubResource( 1 ) - -[node name="Sprite" type="Sprite" parent="Shape"] -texture = ExtResource( 2 ) - -[node name="Light" type="Light2D" parent="."] -texture = ExtResource( 1 ) -texture_scale = 0.5 -color = Color( 1, 0.592157, 0.592157, 1 ) diff --git a/src/entities/Fire.gd b/src/entities/fire/Fire.gd similarity index 97% rename from src/entities/Fire.gd rename to src/entities/fire/Fire.gd index da20bd3..153c874 100644 --- a/src/entities/Fire.gd +++ b/src/entities/fire/Fire.gd @@ -18,7 +18,7 @@ signal intensity_reached_max func set_intensity(value): intensity = clamp(value, min_intensity, max_intensity) # Update everything that needs to be updated when the intensity changes - $Light.texture_scale = value + $Light.scale = Vector2(value, value) # Trigger signals emit_signal("intensity_changed", intensity) # max intensity signal diff --git a/src/entities/fire/Fire.tscn b/src/entities/fire/Fire.tscn new file mode 100644 index 0000000..e3c8985 --- /dev/null +++ b/src/entities/fire/Fire.tscn @@ -0,0 +1,35 @@ +[gd_scene load_steps=7 format=2] + +[ext_resource path="res://src/mechanics/Light.png" type="Texture" id=1] +[ext_resource path="res://src/entities/fire/FirePit.png" type="Texture" id=2] +[ext_resource path="res://src/entities/fire/Fire.gd" type="Script" id=3] +[ext_resource path="res://src/entities/fire/FireFlame.png" type="Texture" id=4] + +[sub_resource type="CapsuleShape2D" id=1] +radius = 20.0 +height = 10.0 + +[sub_resource type="CanvasItemMaterial" id=2] +blend_mode = 1 + +[node name="Fire" type="StaticBody2D"] +script = ExtResource( 3 ) + +[node name="Shape" type="CollisionShape2D" parent="."] +rotation = 1.5708 +shape = SubResource( 1 ) + +[node name="Sprite" type="Sprite" parent="Shape"] +rotation = -1.5708 +texture = ExtResource( 2 ) + +[node name="Light" type="Light2D" parent="."] +texture = ExtResource( 1 ) +texture_scale = 0.5 +color = Color( 1, 0.607843, 0, 1 ) + +[node name="FlameSprite" type="Sprite" parent="Light"] +material = SubResource( 2 ) +z_index = 1 +texture = ExtResource( 4 ) +offset = Vector2( 0, -20 ) diff --git a/src/entities/FireConcept.png b/src/entities/fire/FireConcept.png similarity index 100% rename from src/entities/FireConcept.png rename to src/entities/fire/FireConcept.png diff --git a/src/entities/FireConcept.png.import b/src/entities/fire/FireConcept.png.import similarity index 70% rename from src/entities/FireConcept.png.import rename to src/entities/fire/FireConcept.png.import index dcb2790..61bdda2 100644 --- a/src/entities/FireConcept.png.import +++ b/src/entities/fire/FireConcept.png.import @@ -2,15 +2,15 @@ importer="texture" type="StreamTexture" -path="res://.import/FireConcept.png-78e15c8363ed2ec1d29d99bca93f7c94.stex" +path="res://.import/FireConcept.png-114933ab8aa79dd6fc3e46d793f2cacc.stex" metadata={ "vram_texture": false } [deps] -source_file="res://src/entities/FireConcept.png" -dest_files=[ "res://.import/FireConcept.png-78e15c8363ed2ec1d29d99bca93f7c94.stex" ] +source_file="res://src/entities/fire/FireConcept.png" +dest_files=[ "res://.import/FireConcept.png-114933ab8aa79dd6fc3e46d793f2cacc.stex" ] [params] diff --git a/src/entities/FireFlame.png b/src/entities/fire/FireFlame.png similarity index 100% rename from src/entities/FireFlame.png rename to src/entities/fire/FireFlame.png diff --git a/src/entities/FireFlame.png.import b/src/entities/fire/FireFlame.png.import similarity index 70% rename from src/entities/FireFlame.png.import rename to src/entities/fire/FireFlame.png.import index 33f077f..f072cdc 100644 --- a/src/entities/FireFlame.png.import +++ b/src/entities/fire/FireFlame.png.import @@ -2,15 +2,15 @@ importer="texture" type="StreamTexture" -path="res://.import/FireFlame.png-283ff91e5929cfb0390e695fe6fed3c7.stex" +path="res://.import/FireFlame.png-7fced22da2a25087c1e84afb4e3fc0d5.stex" metadata={ "vram_texture": false } [deps] -source_file="res://src/entities/FireFlame.png" -dest_files=[ "res://.import/FireFlame.png-283ff91e5929cfb0390e695fe6fed3c7.stex" ] +source_file="res://src/entities/fire/FireFlame.png" +dest_files=[ "res://.import/FireFlame.png-7fced22da2a25087c1e84afb4e3fc0d5.stex" ] [params] diff --git a/src/entities/FirePit.png b/src/entities/fire/FirePit.png similarity index 100% rename from src/entities/FirePit.png rename to src/entities/fire/FirePit.png diff --git a/src/entities/FirePit.png.import b/src/entities/fire/FirePit.png.import similarity index 72% rename from src/entities/FirePit.png.import rename to src/entities/fire/FirePit.png.import index 4939683..3e8ad72 100644 --- a/src/entities/FirePit.png.import +++ b/src/entities/fire/FirePit.png.import @@ -2,15 +2,15 @@ importer="texture" type="StreamTexture" -path="res://.import/FirePit.png-ce1f95a9db5ce9d6bc65c2861c968bb8.stex" +path="res://.import/FirePit.png-db9b6d2c86b1e6c12b4fd62d55729693.stex" metadata={ "vram_texture": false } [deps] -source_file="res://src/entities/FirePit.png" -dest_files=[ "res://.import/FirePit.png-ce1f95a9db5ce9d6bc65c2861c968bb8.stex" ] +source_file="res://src/entities/fire/FirePit.png" +dest_files=[ "res://.import/FirePit.png-db9b6d2c86b1e6c12b4fd62d55729693.stex" ] [params] diff --git a/src/levels/Game.tscn b/src/levels/Game.tscn index d42ac96..8d0eaf7 100644 --- a/src/levels/Game.tscn +++ b/src/levels/Game.tscn @@ -2,7 +2,7 @@ [ext_resource path="res://src/mechanics/Background.tscn" type="PackedScene" id=1] [ext_resource path="res://src/mechanics/Darkness.tscn" type="PackedScene" id=2] -[ext_resource path="res://src/entities/Fire.tscn" type="PackedScene" id=3] +[ext_resource path="res://src/entities/fire/Fire.tscn" type="PackedScene" id=3] [ext_resource path="res://src/entities/players/PhaseOnePlayer.tscn" type="PackedScene" id=4] [ext_resource path="res://src/mechanics/RNG.tscn" type="PackedScene" id=5] [ext_resource path="res://src/levels/Game.gd" type="Script" id=6]