Water splash effect

This commit is contained in:
Rob Kelly 2025-01-02 15:16:49 -07:00
parent e255d26239
commit 06d586d8f0
17 changed files with 426 additions and 1 deletions

View File

@ -11,6 +11,14 @@ Asset credits
*** License: CC BY 4.0
** Kenney.nl particle pack
*** Retrieved from https://www.kenney.nl/assets/particle-pack
*** Author: kenney.nl
*** License: CC0
* Fonts
** PromptFont
@ -166,3 +174,11 @@ Asset credits
*** Author: LiamG_SFX
*** License: CC BY 4.0
** objectDunk1.MP3
*** Retrieved from https://freesound.org/people/rabban625/sounds/436473/
*** Author: rabban625
*** License: CC0

BIN
asset_dev/audio/436473__rabban625__objectdunk1.mp3 (Stored with Git LFS) Normal file

Binary file not shown.

BIN
asset_dev/particles/bubble.png (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

BIN
assets/sound/sfx/ball/splash1.wav (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://dutumw1vj854w"
path="res://.godot/imported/splash1.wav-c515553fa6b3d442d978831ce07dccfa.sample"
[deps]
source_file="res://assets/sound/sfx/ball/splash1.wav"
dest_files=["res://.godot/imported/splash1.wav-c515553fa6b3d442d978831ce07dccfa.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

BIN
assets/sprites/particles/bubble.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,36 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bjnil2wvvf35q"
path.s3tc="res://.godot/imported/bubble.png-c5759ab17447a1372d60f0e86df9d865.s3tc.ctex"
path.etc2="res://.godot/imported/bubble.png-c5759ab17447a1372d60f0e86df9d865.etc2.ctex"
metadata={
"imported_formats": ["s3tc_bptc", "etc2_astc"],
"vram_texture": true
}
[deps]
source_file="res://assets/sprites/particles/bubble.png"
dest_files=["res://.godot/imported/bubble.png-c5759ab17447a1372d60f0e86df9d865.s3tc.ctex", "res://.godot/imported/bubble.png-c5759ab17447a1372d60f0e86df9d865.etc2.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
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=0

BIN
assets/sprites/particles/light_03.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bogj6pvl2a7d"
path="res://.godot/imported/light_03.png-cbfa7c9430e204e671021262b00ddb04.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/sprites/particles/light_03.png"
dest_files=["res://.godot/imported/light_03.png-cbfa7c9430e204e671021262b00ddb04.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=true
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=0

View File

@ -271,6 +271,7 @@ textures/canvas_textures/default_texture_filter=0
textures/vram_compression/import_etc2_astc=true
lights_and_shadows/directional_shadow/size=16384
lights_and_shadows/directional_shadow/soft_shadow_filter_quality=0
textures/decals/filter=2
anti_aliasing/quality/msaa_3d=3
anti_aliasing/quality/screen_space_aa=1
anti_aliasing/quality/use_debanding=true

View File

@ -3,3 +3,8 @@ extends GameBall
func enter_zone(zone: BallZone) -> void:
_zones.push_back(zone)
if zone.water_hazard:
effects.play_splash()
# Play effect but don't emit signal
# Also don't play SFX -- kind of annoying tbh

View File

@ -1,11 +1,19 @@
class_name BallParticleEffects extends Node3D
## Controller for ball particle effects.
@export var splash_effect_scene: PackedScene
@onready var sand_particles: GPUParticles3D = %SandParticles
@onready var ball: GameBall = $".."
func play_splash() -> void:
var effect: Node3D = splash_effect_scene.instantiate()
ball.add_sibling(effect)
effect.global_position = ball.global_position
func play_effect(terrain: Terrain.Type) -> void:
global_rotation = Vector3.ZERO
match terrain:

View File

@ -10,6 +10,7 @@ const VELOCITY_ATTENUATION_SCALE := 400.0
@onready var grass_sfx_player: AudioStreamPlayer3D = %GrassSFXPlayer
@onready var concrete_sfx_player: AudioStreamPlayer3D = %ConcreteSFXPlayer
@onready var sand_sfx_player: AudioStreamPlayer3D = %SandSFXPlayer
@onready var splash_sfx_player: AudioStreamPlayer3D = %SplashSFXPlayer
func _force_attenuated_volume() -> float:
@ -35,3 +36,7 @@ func play_sfx(terrain: Terrain.Type) -> void:
_play(concrete_sfx_player)
Terrain.Type.SAND:
_play(sand_sfx_player)
func play_splash() -> void:
_play(splash_sfx_player)

View File

@ -152,6 +152,8 @@ func enter_zone(zone: BallZone) -> void:
_zones.push_back(zone)
if zone.water_hazard:
effects.play_splash()
sfx.play_splash()
entered_water.emit()

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=22 format=3 uid="uid://dfttci386ohip"]
[gd_scene load_steps=25 format=3 uid="uid://dfttci386ohip"]
[ext_resource type="Script" path="res://src/equipment/balls/physics_ball/game_ball.gd" id="1_iwh2u"]
[ext_resource type="PhysicsMaterial" uid="uid://3bih72l068ic" path="res://src/equipment/balls/physics_ball/normal_physics.tres" id="1_l23pw"]
@ -10,8 +10,10 @@
[ext_resource type="AudioStream" uid="uid://3csnnhxndt67" path="res://assets/sound/sfx/ball/concrete5.wav" id="9_p0lmw"]
[ext_resource type="AudioStream" uid="uid://bbbp6wrkuhkek" path="res://assets/sound/sfx/ball/sand1.wav" id="10_b64mx"]
[ext_resource type="AudioStream" uid="uid://b5xx5t050i4p" path="res://assets/sound/sfx/ball/sand2.wav" id="11_ed8je"]
[ext_resource type="AudioStream" uid="uid://dutumw1vj854w" path="res://assets/sound/sfx/ball/splash1.wav" id="11_xmj6n"]
[ext_resource type="Script" path="res://src/equipment/balls/physics_ball/ball_particle_effects.gd" id="12_7krl6"]
[ext_resource type="Texture2D" uid="uid://c47bkx508biqr" path="res://assets/sprites/particles/plasma.png" id="12_guipt"]
[ext_resource type="PackedScene" uid="uid://cm4bb3lg4mfd2" path="res://src/world/effects/splash/splash_effect.tscn" id="12_qlrvx"]
[sub_resource type="SphereMesh" id="SphereMesh_y0d13"]
material = ExtResource("3_rc7m1")
@ -95,6 +97,11 @@ streams_count = 2
stream_0/stream = ExtResource("10_b64mx")
stream_1/stream = ExtResource("11_ed8je")
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_nlbkf"]
playback_mode = 1
streams_count = 1
stream_0/stream = ExtResource("11_xmj6n")
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_mwiw1"]
angle_min = -720.0
angle_max = 720.0
@ -176,6 +183,12 @@ unit_size = 40.0
max_db = 0.0
bus = &"SFX"
[node name="SplashSFXPlayer" type="AudioStreamPlayer3D" parent="SFX"]
unique_name_in_owner = true
stream = SubResource("AudioStreamRandomizer_nlbkf")
unit_size = 40.0
bus = &"SFX"
[node name="ManualSleepTimer" type="Timer" parent="."]
unique_name_in_owner = true
one_shot = true
@ -187,6 +200,7 @@ one_shot = true
[node name="ParticleEffects" type="Node3D" parent="."]
unique_name_in_owner = true
script = ExtResource("12_7krl6")
splash_effect_scene = ExtResource("12_qlrvx")
[node name="SandParticles" type="GPUParticles3D" parent="ParticleEffects"]
unique_name_in_owner = true

View File

@ -0,0 +1,265 @@
[gd_scene load_steps=25 format=3 uid="uid://cm4bb3lg4mfd2"]
[ext_resource type="Texture2D" uid="uid://bogj6pvl2a7d" path="res://assets/sprites/particles/light_03.png" id="1_xmlec"]
[ext_resource type="Texture2D" uid="uid://67r5iwexjlsc" path="res://assets/sprites/particles/dot.png" id="2_tcvw8"]
[ext_resource type="Texture2D" uid="uid://bjnil2wvvf35q" path="res://assets/sprites/particles/bubble.png" id="3_jouu7"]
[sub_resource type="Curve" id="Curve_tw8s6"]
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(0.5, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 3
[sub_resource type="CurveTexture" id="CurveTexture_pa3gt"]
curve = SubResource("Curve_tw8s6")
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_vx5ug"]
direction = Vector3(0, 1, 0)
initial_velocity_min = 4.0
initial_velocity_max = 4.0
alpha_curve = SubResource("CurveTexture_pa3gt")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ik45x"]
transparency = 1
cull_mode = 2
shading_mode = 0
vertex_color_use_as_albedo = true
albedo_color = Color(0.78, 0.930333, 1, 1)
albedo_texture = ExtResource("2_tcvw8")
texture_filter = 2
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_kmdkq"]
material = SubResource("StandardMaterial3D_ik45x")
size = Vector2(0.02, 0.02)
[sub_resource type="Curve" id="Curve_ul71f"]
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(0.75, 1), 0.0, 0.0, 0, 0, Vector2(0.751, 0), 0.0, 0.0, 0, 0, Vector2(0.8, 0), 0.0, 0.0, 0, 0, Vector2(0.801, 0.8), 0.0, 0.0, 0, 0, Vector2(0.85, 0.8), 0.0, 0.0, 0, 0, Vector2(0.851, 0), 0.0, 0.0, 0, 0, Vector2(0.9, 0), 0.0, 0.0, 0, 0, Vector2(0.901, 0.6), 0.0, 0.0, 0, 0, Vector2(0.95, 0.6), 0.0, 0.0, 0, 0, Vector2(0.951, 0), 0.0, 0.0, 0, 0]
point_count = 11
[sub_resource type="CurveTexture" id="CurveTexture_3sk7y"]
curve = SubResource("Curve_ul71f")
[sub_resource type="Curve" id="Curve_p2m8m"]
[sub_resource type="Curve" id="Curve_vydb8"]
_data = [Vector2(0, 1), 0.0, -2.42919, 0, 0, Vector2(0.250526, 0.0845791), 0.0, 0.0, 0, 0]
point_count = 2
[sub_resource type="Curve" id="Curve_yflu4"]
[sub_resource type="CurveXYZTexture" id="CurveXYZTexture_ctsfi"]
curve_x = SubResource("Curve_p2m8m")
curve_y = SubResource("Curve_vydb8")
curve_z = SubResource("Curve_yflu4")
[sub_resource type="Curve" id="Curve_n4ky6"]
min_value = -2.0
max_value = 2.0
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 2
[sub_resource type="Curve" id="Curve_mvwav"]
min_value = -2.0
max_value = 2.0
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0]
point_count = 2
[sub_resource type="Curve" id="Curve_15euc"]
min_value = -2.0
max_value = 2.0
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 2
[sub_resource type="CurveXYZTexture" id="CurveXYZTexture_4bki0"]
curve_x = SubResource("Curve_n4ky6")
curve_y = SubResource("Curve_mvwav")
curve_z = SubResource("Curve_15euc")
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_v0h0y"]
lifetime_randomness = 0.33
direction = Vector3(0, 1, 0)
spread = 30.0
initial_velocity_min = 0.3
initial_velocity_max = 0.3
directional_velocity_min = 1.0
directional_velocity_max = 1.0
directional_velocity_curve = SubResource("CurveXYZTexture_ctsfi")
orbit_velocity_min = 0.5
orbit_velocity_max = 2.0
orbit_velocity_curve = SubResource("CurveXYZTexture_4bki0")
gravity = Vector3(0, 0, 0)
alpha_curve = SubResource("CurveTexture_3sk7y")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_l1irr"]
transparency = 1
cull_mode = 2
shading_mode = 0
vertex_color_use_as_albedo = true
albedo_texture = ExtResource("3_jouu7")
texture_filter = 2
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_lvunc"]
material = SubResource("StandardMaterial3D_l1irr")
size = Vector2(0.1, 0.1)
[sub_resource type="Animation" id="Animation_ifddj"]
resource_name = "effect"
length = 2.0
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Decal:size")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 2),
"transitions": PackedFloat32Array(0.382, 1),
"update": 0,
"values": [Vector3(0, 4, 0), Vector3(4, 4, 4)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Decal:modulate")
tracks/1/interp = 2
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 2),
"transitions": PackedFloat32Array(0.618, 1),
"update": 0,
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("SprayParticles:emitting")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("BubbleParticles:emitting")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/4/type = "method"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath(".")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(2),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"queue_free"
}]
}
[sub_resource type="Animation" id="Animation_mg6va"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Decal:size")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector3(2, 4, 2)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Decal:modulate")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 1)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("SprayParticles:emitting")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("BubbleParticles:emitting")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_87fye"]
_data = {
"RESET": SubResource("Animation_mg6va"),
"effect": SubResource("Animation_ifddj")
}
[node name="SplashEffect" type="Node3D"]
[node name="Decal" type="Decal" parent="."]
size = Vector3(2, 4, 2)
texture_albedo = ExtResource("1_xmlec")
[node name="SprayParticles" type="GPUParticles3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1, 0)
emitting = false
lifetime = 0.6
one_shot = true
explosiveness = 0.9
process_material = SubResource("ParticleProcessMaterial_vx5ug")
draw_pass_1 = SubResource("QuadMesh_kmdkq")
[node name="BubbleParticles" type="GPUParticles3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1, 0)
emitting = false
amount = 2
lifetime = 3.0
one_shot = true
explosiveness = 0.8
process_material = SubResource("ParticleProcessMaterial_v0h0y")
draw_pass_1 = SubResource("QuadMesh_lvunc")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_87fye")
}
autoplay = "effect"