2.18 one shot particles

This commit is contained in:
david 2025-02-09 14:53:25 +01:00
parent 097a090b24
commit 4550eb5561
4 changed files with 126 additions and 1 deletions

View file

@ -13,6 +13,8 @@ public partial class Player : RigidBody3D
private GpuParticles3D boosterParticles;
private GpuParticles3D boosterLeftParticles;
private GpuParticles3D boosterRightParticles;
private GpuParticles3D explosionParticles;
private GpuParticles3D successParticles;
private AudioStreamPlayer deathAudioPlayer;
private AudioStreamPlayer successAudioPlayer;
@ -23,6 +25,9 @@ public partial class Player : RigidBody3D
boosterParticles = GetNode<GpuParticles3D>("BoosterParticles");
boosterLeftParticles = GetNode<GpuParticles3D>("BoosterLeftParticles");
boosterRightParticles = GetNode<GpuParticles3D>("BoosterRightParticles");
explosionParticles = GetNode<GpuParticles3D>("ExplosionParticles");
successParticles = GetNode<GpuParticles3D>("SuccessParticles");
deathAudioPlayer = GetNode<AudioStreamPlayer>("DeathAudioPlayer");
successAudioPlayer = GetNode<AudioStreamPlayer>("SuccessAudioPlayer");
rocketAudioPlayer = GetNode<AudioStreamPlayer3D>("RocketAudioPlayer");
@ -74,6 +79,7 @@ public partial class Player : RigidBody3D
deathAudioPlayer.Play();
rocketAudioPlayer.Stop();
boosterParticles.Emitting = false;
explosionParticles.Emitting = true;
Tween tween = CreateTween();
tween.TweenInterval(2.5);
tween.TweenCallback(Callable.From(() => DeferredCalls.ReloadCurrentScene(this)));
@ -83,6 +89,7 @@ public partial class Player : RigidBody3D
private void CompleteLevel(string nextLevel){
successAudioPlayer.Play();
successParticles.Emitting = true;
Tween tween = CreateTween();
tween.TweenInterval(2.3);
tween.TweenCallback(Callable.From(() => DeferredCalls.ChangeSceneToFile(this, nextLevel)));

View file

@ -0,0 +1,59 @@
[gd_scene load_steps=10 format=3 uid="uid://dcecb8hw7dbrv"]
[sub_resource type="Gradient" id="Gradient_lkolc"]
offsets = PackedFloat32Array(0.201923, 0.413462, 0.586538, 0.740385, 0.903846)
colors = PackedColorArray(1, 1, 1, 1, 1, 1, 0, 1, 1, 0.294118, 0, 1, 0.776471, 0, 0, 1, 0, 0, 0, 1)
[sub_resource type="GradientTexture1D" id="GradientTexture1D_u3rij"]
gradient = SubResource("Gradient_lkolc")
[sub_resource type="Curve" id="Curve_cv3ok"]
max_value = 100.0
_data = [Vector2(0, 1), 0.0, 146.581, 0, 0, Vector2(1, 100), 413.249, 0.0, 0, 0]
point_count = 2
[sub_resource type="CurveTexture" id="CurveTexture_mygan"]
curve = SubResource("Curve_cv3ok")
[sub_resource type="Curve" id="Curve_qubh3"]
_data = [Vector2(0, 0.530249), 0.0, 2.25724, 0, 0, Vector2(1, 0), -2.97204, 0.0, 0, 0]
point_count = 2
[sub_resource type="CurveTexture" id="CurveTexture_5bhb0"]
curve = SubResource("Curve_qubh3")
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_1onfr"]
direction = Vector3(0, 1, 0)
spread = 180.0
gravity = Vector3(0, 0, 0)
initial_velocity_min = 6.0
initial_velocity_max = 16.0
damping_max = 3.0
damping_curve = SubResource("CurveTexture_mygan")
scale_curve = SubResource("CurveTexture_5bhb0")
color_ramp = SubResource("GradientTexture1D_u3rij")
turbulence_enabled = true
turbulence_noise_scale = 1.0
turbulence_noise_speed_random = 4.0
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_5wvwh"]
shading_mode = 0
vertex_color_use_as_albedo = true
disable_receive_shadows = true
billboard_mode = 3
billboard_keep_scale = true
particles_anim_h_frames = 1
particles_anim_v_frames = 1
particles_anim_loop = false
[sub_resource type="QuadMesh" id="QuadMesh_gb05o"]
material = SubResource("StandardMaterial3D_5wvwh")
[node name="ExplosionParticles" type="GPUParticles3D"]
cast_shadow = 0
emitting = false
amount = 64
one_shot = true
explosiveness = 0.75
process_material = SubResource("ParticleProcessMaterial_1onfr")
draw_pass_1 = SubResource("QuadMesh_gb05o")

View file

@ -1,10 +1,12 @@
[gd_scene load_steps=8 format=3 uid="uid://cuduv6fwqtocs"]
[gd_scene load_steps=10 format=3 uid="uid://cuduv6fwqtocs"]
[ext_resource type="Script" path="res://scenes/characters/Player.cs" id="1_fr1bo"]
[ext_resource type="AudioStream" uid="uid://nsq05kpsix83" path="res://resources/audio/SFX - Death Explosion.ogg" id="2_ml1je"]
[ext_resource type="AudioStream" uid="uid://cr4ckjeqxa5xe" path="res://resources/audio/SFX - Success.ogg" id="3_xmihe"]
[ext_resource type="AudioStream" uid="uid://dyf7x2qy7lww" path="res://resources/audio/SFX - Main engine thrust.ogg" id="4_204bm"]
[ext_resource type="PackedScene" uid="uid://ux6ivcx1ovdp" path="res://scenes/characters/booster_particles.tscn" id="5_q1ic3"]
[ext_resource type="PackedScene" path="res://scenes/characters/explosion_particles.tscn" id="6_wmkg1"]
[ext_resource type="PackedScene" path="res://scenes/characters/success_particles.tscn" id="7_8jcat"]
[sub_resource type="CylinderMesh" id="CylinderMesh_dk8lw"]
@ -46,3 +48,7 @@ emitting = false
[node name="BoosterRightParticles" parent="." instance=ExtResource("5_q1ic3")]
transform = Transform3D(1, 0, 0, 0, 0.939693, 0.34202, 0, -0.34202, 0.939693, 0, -1, 0.4)
emitting = false
[node name="ExplosionParticles" parent="." instance=ExtResource("6_wmkg1")]
[node name="SuccessParticles" parent="." instance=ExtResource("7_8jcat")]

View file

@ -0,0 +1,53 @@
[gd_scene load_steps=8 format=3 uid="uid://jfwajmrh6ca7"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_5wvwh"]
shading_mode = 0
vertex_color_use_as_albedo = true
disable_receive_shadows = true
billboard_mode = 3
billboard_keep_scale = true
particles_anim_h_frames = 1
particles_anim_v_frames = 1
particles_anim_loop = false
[sub_resource type="Curve" id="Curve_qubh3"]
_data = [Vector2(0, 0.530249), 0.0, 2.25724, 0, 0, Vector2(1, 0), -2.97204, 0.0, 0, 0]
point_count = 2
[sub_resource type="CurveTexture" id="CurveTexture_oh0x3"]
curve = SubResource("Curve_qubh3")
[sub_resource type="Curve" id="Curve_uupei"]
_data = [Vector2(0, 0.5), 0.0, 2.46667, 0, 1, Vector2(0.202703, 1), 0.0, 0.0, 0, 0, Vector2(0.371622, 0.00355875), 0.0, 0.0, 0, 0, Vector2(0.554054, 1), 0.0, 0.0, 0, 0, Vector2(0.777027, 0), 0.0, 0.0, 0, 0, Vector2(0.885135, 1), 0.0, 0.0, 0, 0, Vector2(1, 0.5), -4.35294, 0.0, 1, 0]
point_count = 7
[sub_resource type="CurveTexture" id="CurveTexture_68duu"]
curve = SubResource("Curve_uupei")
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_2ssod"]
direction = Vector3(0, 1, 0)
spread = 180.0
gravity = Vector3(0, 0, 0)
initial_velocity_min = 3.0
initial_velocity_max = 12.0
damping_min = 2.0
damping_max = 4.0
scale_curve = SubResource("CurveTexture_oh0x3")
hue_variation_min = -1.0
hue_variation_max = 1.0
turbulence_enabled = true
turbulence_noise_scale = 4.0
turbulence_influence_max = 0.3
turbulence_influence_over_life = SubResource("CurveTexture_68duu")
[sub_resource type="SphereMesh" id="SphereMesh_lkpya"]
[node name="SuccessParticles" type="GPUParticles3D"]
material_override = SubResource("StandardMaterial3D_5wvwh")
cast_shadow = 0
emitting = false
amount = 48
one_shot = true
explosiveness = 0.5
process_material = SubResource("ParticleProcessMaterial_2ssod")
draw_pass_1 = SubResource("SphereMesh_lkpya")