campfire flashing

pull/3/head
John Montagu, the 4th Earl of Sandvich 2023-05-30 01:35:29 -07:00
parent 9c763357b9
commit 323dcbebd6
Signed by: sandvich
GPG Key ID: 9A39BE37E602B22D
3 changed files with 54 additions and 7 deletions

View File

@ -5,5 +5,20 @@ namespace SupaLidlGame.Entities
{ {
public partial class Campfire : StaticBody2D public partial class Campfire : StaticBody2D
{ {
private PointLight2D _light;
[Signal]
public delegate void OnCampfireUse();
public override void _Ready()
{
_light = GetNode<PointLight2D>("PointLight2D");
}
public override void _Process(double delta)
{
_light.Energy += (GD.Randf() - 0.5f) * 8 * (float)delta;
_light.Energy = Math.Clamp(_light.Energy, 1.2f, 2.0f);
}
} }
} }

View File

@ -62,10 +62,10 @@ script = ExtResource("1_w4gfp")
[node name="Sprite2D" type="AnimatedSprite2D" parent="."] [node name="Sprite2D" type="AnimatedSprite2D" parent="."]
sprite_frames = SubResource("SpriteFrames_o6lfi") sprite_frames = SubResource("SpriteFrames_o6lfi")
animation = &"active" frame_progress = 0.387757
[node name="PointLight2D" type="PointLight2D" parent="."] [node name="PointLight2D" type="PointLight2D" parent="."]
color = Color(0.976471, 0.564706, 0.168627, 1) color = Color(0.996078, 0.780392, 0.615686, 1)
energy = 2.0 energy = 2.0
blend_mode = 2 blend_mode = 2
texture = ExtResource("3_lm3vq") texture = ExtResource("3_lm3vq")

View File

@ -1,10 +1,10 @@
[gd_scene load_steps=9 format=3 uid="uid://bxtpv6jqodj4v"] [gd_scene load_steps=14 format=3 uid="uid://bxtpv6jqodj4v"]
[ext_resource type="PackedScene" uid="uid://clwv2owvk6abe" path="res://Scenes/BaseMap.tscn" id="1_vly6f"] [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"] [ext_resource type="Texture2D" uid="uid://dl2h266oa2x31" path="res://Assets/Sprites/night-grass.png" id="2_ote21"]
[ext_resource type="PackedScene" uid="uid://bf55wbq7m1gpp" path="res://Characters/ExampleEnemy.tscn" id="3_hwof6"] [ext_resource type="PackedScene" uid="uid://bf55wbq7m1gpp" path="res://Characters/ExampleEnemy.tscn" id="3_hwof6"]
[ext_resource type="Shader" path="res://Shaders/Flash.gdshader" id="4_mwgaq"]
[ext_resource type="PackedScene" uid="uid://5nvn1tw56m8e" path="res://Utils/Spawner.tscn" id="4_pi4df"] [ext_resource type="PackedScene" uid="uid://5nvn1tw56m8e" path="res://Utils/Spawner.tscn" id="4_pi4df"]
[ext_resource type="PackedScene" uid="uid://bqvseo3sbs1aj" path="res://Entities/RailBeam.tscn" id="4_vxueq"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_dvbe3"] [sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_dvbe3"]
texture = ExtResource("2_ote21") texture = ExtResource("2_ote21")
@ -211,6 +211,36 @@ physics_layer_0/collision_mask = 16
physics_layer_1/collision_layer = 1 physics_layer_1/collision_layer = 1
sources/0 = SubResource("TileSetAtlasSource_dvbe3") sources/0 = SubResource("TileSetAtlasSource_dvbe3")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_kq7i3"]
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_ck37u"]
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_3i2mi"]
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_trolh"]
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_vuv4g"]
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="RectangleShape2D" id="RectangleShape2D_oods2"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_oods2"]
size = Vector2(128, 64) size = Vector2(128, 64)
@ -221,18 +251,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) 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")] [node name="ExampleEnemy" parent="Entities" index="0" instance=ExtResource("3_hwof6")]
material = SubResource("ShaderMaterial_kq7i3")
position = Vector2(169, 115) position = Vector2(169, 115)
[node name="ExampleEnemy2" parent="Entities" index="1" instance=ExtResource("3_hwof6")] [node name="ExampleEnemy2" parent="Entities" index="1" instance=ExtResource("3_hwof6")]
material = SubResource("ShaderMaterial_ck37u")
position = Vector2(75, 130) position = Vector2(75, 130)
[node name="ExampleEnemy3" parent="Entities" index="2" instance=ExtResource("3_hwof6")] [node name="ExampleEnemy3" parent="Entities" index="2" instance=ExtResource("3_hwof6")]
material = SubResource("ShaderMaterial_3i2mi")
position = Vector2(140, 177) position = Vector2(140, 177)
[node name="ExampleEnemy4" parent="Entities" index="3" instance=ExtResource("3_hwof6")] [node name="ExampleEnemy4" parent="Entities" index="3" instance=ExtResource("3_hwof6")]
material = SubResource("ShaderMaterial_trolh")
position = Vector2(14, 159) position = Vector2(14, 159)
[node name="ExampleEnemy5" parent="Entities" index="4" instance=ExtResource("3_hwof6")] [node name="ExampleEnemy5" parent="Entities" index="4" instance=ExtResource("3_hwof6")]
material = SubResource("ShaderMaterial_vuv4g")
position = Vector2(10, 22) position = Vector2(10, 22)
Faction = 1 Faction = 1
@ -244,7 +279,4 @@ SpawnTime = 5.0
[node name="CollisionShape2D" parent="Spawners/Spawner/Area2D" index="0"] [node name="CollisionShape2D" parent="Spawners/Spawner/Area2D" index="0"]
shape = SubResource("RectangleShape2D_oods2") shape = SubResource("RectangleShape2D_oods2")
[node name="RailBeam" parent="." index="6" instance=ExtResource("4_vxueq")]
position = Vector2(55, 8)
[editable path="Spawners/Spawner"] [editable path="Spawners/Spawner"]