feat(particles): bubble trail behind dolphin + block break burst
- BubbleTrail.gd: GPUParticles3D, auto-configured in _ready, set_intensity() API - BlockBreakParticles.gd: one_shot burst, emit_burst(pos, color) API - DolphinController.gd: bubble_trail onready + speed_factor hook in _update_movement - Dolphin.tscn: BubbleEmitterPoint (0,0,1.2) > BubbleTrail child added Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
52
scripts/dolphin/BubbleTrail.gd
Normal file
52
scripts/dolphin/BubbleTrail.gd
Normal file
@@ -0,0 +1,52 @@
|
||||
extends GPUParticles3D
|
||||
|
||||
func _ready() -> void:
|
||||
amount = 80
|
||||
lifetime = 1.5
|
||||
emitting = false
|
||||
local_coords = false
|
||||
|
||||
var mat := ParticleProcessMaterial.new()
|
||||
mat.direction = Vector3(0.0, 0.3, 0.0)
|
||||
mat.initial_velocity_min = 0.5
|
||||
mat.initial_velocity_max = 1.5
|
||||
mat.spread = 15.0
|
||||
mat.gravity = Vector3(0.0, 0.5, 0.0)
|
||||
mat.scale_min = 0.03
|
||||
mat.scale_max = 0.12
|
||||
|
||||
var scale_curve := Curve.new()
|
||||
scale_curve.add_point(Vector2(0.0, 0.2))
|
||||
scale_curve.add_point(Vector2(0.5, 1.0))
|
||||
scale_curve.add_point(Vector2(1.0, 0.0))
|
||||
var scale_curve_tex := CurveTexture.new()
|
||||
scale_curve_tex.curve = scale_curve
|
||||
mat.scale_curve = scale_curve_tex
|
||||
|
||||
mat.color = Color(1.0, 1.0, 1.0, 0.6)
|
||||
process_material = mat
|
||||
|
||||
var sphere := SphereMesh.new()
|
||||
sphere.radius = 0.05
|
||||
sphere.height = 0.1
|
||||
sphere.rings = 4
|
||||
sphere.radial_segments = 6
|
||||
|
||||
var bubble_mat := StandardMaterial3D.new()
|
||||
bubble_mat.shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED
|
||||
bubble_mat.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA
|
||||
bubble_mat.albedo_color = Color(1.0, 1.0, 1.0, 0.55)
|
||||
bubble_mat.emission_enabled = true
|
||||
bubble_mat.emission = Color(0.8, 0.9, 1.0, 1.0)
|
||||
bubble_mat.emission_energy_multiplier = 0.3
|
||||
sphere.surface_set_material(0, bubble_mat)
|
||||
|
||||
draw_pass_1 = sphere
|
||||
|
||||
|
||||
func set_intensity(speed_factor: float) -> void:
|
||||
if speed_factor > 0.5:
|
||||
emitting = true
|
||||
amount_ratio = clamp(speed_factor / 1.5, 0.3, 1.0)
|
||||
else:
|
||||
emitting = false
|
||||
Reference in New Issue
Block a user