Added light to explosions

master
Marc Gilleron 2020-08-17 21:27:00 +01:00
parent 43d14bf329
commit 0cf01b53e0
2 changed files with 48 additions and 10 deletions

View File

@ -1,10 +1,12 @@
extends Spatial
onready var _particles = $Particles
onready var _animation_player = $AnimationPlayer
func _ready():
_particles.emitting = true
_animation_player.play("explode")
func _on_Timer_timeout():

View File

@ -1,9 +1,8 @@
[gd_scene load_steps=10 format=2]
[gd_scene load_steps=11 format=2]
[ext_resource path="res://blocky_game/items/rocket_launcher/smoke_particle.png" type="Texture" id=1]
[ext_resource path="res://blocky_game/items/rocket_launcher/rocket_explosion.gd" type="Script" id=2]
[sub_resource type="SpatialMaterial" id=1]
flags_transparent = true
vertex_color_use_as_albedo = true
@ -20,13 +19,13 @@ colors = PoolColorArray( 1, 1, 1, 1, 1, 1, 1, 0 )
gradient = SubResource( 2 )
width = 64
[sub_resource type="Curve" id=6]
[sub_resource type="Curve" id=4]
_data = [ Vector2( 0, 0.364035 ), 0.0, 6.99055, 0, 0, Vector2( 0.0810811, 0.723684 ), 0.0, 0.0, 0, 0, Vector2( 1, 0.399123 ), 0.0, 0.0, 0, 0 ]
[sub_resource type="CurveTexture" id=7]
curve = SubResource( 6 )
[sub_resource type="CurveTexture" id=5]
curve = SubResource( 4 )
[sub_resource type="ParticlesMaterial" id=4]
[sub_resource type="ParticlesMaterial" id=6]
render_priority = -1
direction = Vector3( 0, 1, 0 )
spread = 170.0
@ -36,10 +35,39 @@ initial_velocity_random = 0.51
linear_accel = -6.0
scale = 10.0
scale_random = 0.39
scale_curve = SubResource( 7 )
scale_curve = SubResource( 5 )
color_ramp = SubResource( 3 )
[sub_resource type="QuadMesh" id=5]
[sub_resource type="QuadMesh" id=7]
[sub_resource type="Animation" id=8]
resource_name = "explode"
tracks/0/type = "value"
tracks/0/path = NodePath("OmniLight:light_energy")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.6 ),
"transitions": PoolRealArray( 0.203063, 1 ),
"update": 0,
"values": [ 10.0, 0.0 ]
}
tracks/1/type = "method"
tracks/1/path = NodePath("OmniLight")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0.6 ),
"transitions": PoolRealArray( 1 ),
"values": [ {
"args": [ ],
"method": "hide"
} ]
}
[node name="RocketExplosion" type="Spatial"]
script = ExtResource( 2 )
@ -51,8 +79,8 @@ amount = 15
lifetime = 2.0
one_shot = true
explosiveness = 0.95
process_material = SubResource( 4 )
draw_pass_1 = SubResource( 5 )
process_material = SubResource( 6 )
draw_pass_1 = SubResource( 7 )
[node name="DirectionalLight" type="DirectionalLight" parent="."]
transform = Transform( 1, 0, 0, 0, 0.790016, 0.613086, 0, -0.613086, 0.790016, 0, 3.14598, 4.16366 )
@ -61,4 +89,12 @@ editor_only = true
[node name="Timer" type="Timer" parent="."]
wait_time = 3.0
autostart = true
[node name="OmniLight" type="OmniLight" parent="."]
light_color = Color( 1, 0.898039, 0.552941, 1 )
light_energy = 8.0
omni_range = 10.0
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
anims/explode = SubResource( 8 )
[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]