Loading...
Loading...
Expert blueprint for GPU particle systems (explosions, magic effects, weather, trails) using GPUParticles2D/3D, ParticleProcessMaterial, gradients, sub-emitters, and custom shaders. Use when creating VFX, environmental effects, or visual feedback. Keywords GPUParticles2D, ParticleProcessMaterial, emission_shape, color_ramp, sub_emitter, one_shot.
npx skill4agent add thedivergentai/gd-agentic-skills godot-particlesemitting = falseemitting = trueamountamountOS.get_name()queue_free()await create_timer(lifetime).timeoutqueue_free()emission_shape = POINTEMISSION_SHAPE_SPHEREColor(r, g, b, 0.0)# Add GPUParticles2D node
# Set Amount: 32
# Set Lifetime: 1.0
# Set One Shot: true (for explosions)# Create ParticleProcessMaterial
var material := ParticleProcessMaterial.new()
# Emission shape
material.emission_shape = ParticleProcessMaterial.EMISSION_SHAPE_SPHERE
material.emission_sphere_radius = 10.0
# Gravity
material.gravity = Vector3(0, 98, 0)
# Velocity
material.initial_velocity_min = 50.0
material.initial_velocity_max = 100.0
# Color
material.color = Color.ORANGE_RED
# Apply to godot-particles
$GPUParticles2D.process_material = materialextends GPUParticles2D
func _ready() -> void:
one_shot = true
amount = 64
lifetime = 0.8
explosiveness = 0.9
var mat := ParticleProcessMaterial.new()
mat.emission_shape = ParticleProcessMaterial.EMISSION_SHAPE_SPHERE
mat.emission_sphere_radius = 5.0
mat.initial_velocity_min = 100.0
mat.initial_velocity_max = 200.0
mat.gravity = Vector3(0, 200, 0)
mat.scale_min = 0.5
mat.scale_max = 1.5
process_material = mat
emitting = trueextends GPUParticles2D
func _ready() -> void:
amount = 16
lifetime = 2.0
var mat := ParticleProcessMaterial.new()
mat.direction = Vector3(0, -1, 0)
mat.initial_velocity_min = 20.0
mat.initial_velocity_max = 40.0
mat.scale_min = 0.5
mat.scale_max = 1.0
mat.color = Color(0.5, 0.5, 0.5, 0.5)
process_material = matvar mat := ParticleProcessMaterial.new()
mat.emission_shape = ParticleProcessMaterial.EMISSION_SHAPE_BOX
mat.emission_box_extents = Vector3(100, 100, 0)
mat.gravity = Vector3.ZERO
mat.angular_velocity_min = -180
mat.angular_velocity_max = 180
mat.scale_min = 0.1
mat.scale_max = 0.5
# Use star texture
$GPUParticles2D.texture = load("res://textures/star.png")
$GPUParticles2D.process_material = mat# player.gd
const EXPLOSION_EFFECT := preload("res://effects/explosion.tscn")
func die() -> void:
var explosion := EXPLOSION_EFFECT.instantiate()
get_parent().add_child(explosion)
explosion.global_position = global_position
explosion.emitting = true
queue_free()extends GPUParticles3D
func _ready() -> void:
amount = 100
lifetime = 3.0
var mat := ParticleProcessMaterial.new()
mat.emission_shape = ParticleProcessMaterial.EMISSION_SHAPE_BOX
mat.emission_box_extents = Vector3(10, 0.1, 10)
mat.direction = Vector3.UP
mat.initial_velocity_min = 2.0
mat.initial_velocity_max = 5.0
mat.gravity = Vector3(0, -9.8, 0)
process_material = matvar mat := ParticleProcessMaterial.new()
# Create gradient
var gradient := Gradient.new()
gradient.add_point(0.0, Color.YELLOW)
gradient.add_point(0.5, Color.ORANGE)
gradient.add_point(1.0, Color(0.5, 0.0, 0.0, 0.0)) # Fade to transparent red
var gradient_texture := GradientTexture1D.new()
gradient_texture.gradient = gradient
mat.color_ramp = gradient_texture# Particles that spawn godot-particles (fireworks)
$ParentParticles.sub_emitter = $ChildParticles.get_path()
$ParentParticles.sub_emitter_mode = GPUParticles2D.SUB_EMITTER_AT_END# Add texture to godot-particles
$GPUParticles2D.texture = load("res://textures/particle.png")# Auto-delete one-shot godot-particles
if one_shot:
await get_tree().create_timer(lifetime).timeout
queue_free()# Reduce amount for mobile
if OS.get_name() == "Android":
amount = amount / 2