Files
dauphincraft/scripts/dolphin/BlockBreakParticles.gd
Floppyrj45 a8341355e3 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>
2026-04-19 18:09:21 +02:00

39 lines
1.0 KiB
GDScript

extends GPUParticles3D
func _ready() -> void:
amount = 30
lifetime = 0.8
one_shot = true
emitting = false
local_coords = false
var mat := ParticleProcessMaterial.new()
mat.direction = Vector3(0.0, 1.0, 0.0)
mat.initial_velocity_min = 1.0
mat.initial_velocity_max = 3.0
mat.spread = 60.0
mat.gravity = Vector3(0.0, -2.0, 0.0)
mat.scale_min = 0.05
mat.scale_max = 0.15
process_material = mat
var box := BoxMesh.new()
box.size = Vector3(0.08, 0.08, 0.08)
var burst_mat := StandardMaterial3D.new()
burst_mat.shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED
burst_mat.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA
burst_mat.albedo_color = Color(0.8, 0.7, 0.5, 0.9)
box.surface_set_material(0, burst_mat)
draw_pass_1 = box
func emit_burst(pos: Vector3, color: Color) -> void:
global_position = pos
if draw_pass_1 and draw_pass_1.surface_get_material(0):
var mat := draw_pass_1.surface_get_material(0) as StandardMaterial3D
if mat:
mat.albedo_color = Color(color.r, color.g, color.b, 0.9)
emitting = true