extends BouncingProjectile class_name GrenadeProjectile func _ready() -> void: super._ready() fuse_time = 4.0 bounciness = 0.5 drop_gravity = 15.0 explosion_radius = 5.0 damage = 120.0 func _setup_effects() -> void: # No flight loop — a lobbed grenade flies silently (the rocket engine # loop read as "the grenade is on fire"). Bounces still make noise. # Grenade Body var body_mesh = MeshInstance3D.new() var sphere = SphereMesh.new() sphere.radius = 0.1 sphere.height = 0.2 var b_mat = StandardMaterial3D.new() b_mat.albedo_color = Color(0.2, 0.4, 0.2) # Dark green b_mat.roughness = 0.6 b_mat.metallic = 0.5 sphere.material = b_mat body_mesh.mesh = sphere add_child(body_mesh) # Smoke Trail (White translucent tail) smoke_sys = GPUParticles3D.new() var smoke_mat = ParticleProcessMaterial.new() smoke_mat.direction = Vector3(0, 0, 1) smoke_mat.spread = 5.0 smoke_mat.initial_velocity_min = 0.0 smoke_mat.initial_velocity_max = 0.5 smoke_mat.gravity = Vector3(0, 0.1, 0) # Less floaty var grad = Gradient.new() grad.add_point(0.0, Color(1.0, 1.0, 1.0, 0.5)) grad.add_point(1.0, Color(1.0, 1.0, 1.0, 0.0)) var grad_tex = GradientTexture1D.new() grad_tex.gradient = grad smoke_mat.color_ramp = grad_tex var curve = Curve.new() curve.add_point(Vector2(0.0, 0.5)) curve.add_point(Vector2(1.0, 1.5)) var curve_tex = CurveTexture.new() curve_tex.curve = curve smoke_mat.scale_curve = curve_tex var smoke_mesh = QuadMesh.new() smoke_mesh.size = Vector2(0.2, 0.2) var s_mat = StandardMaterial3D.new() s_mat.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA s_mat.vertex_color_use_as_albedo = true s_mat.albedo_texture = get_smoke_texture() s_mat.billboard_mode = BaseMaterial3D.BILLBOARD_PARTICLES s_mat.billboard_keep_scale = true smoke_mesh.material = s_mat smoke_sys.draw_pass_1 = smoke_mesh smoke_sys.process_material = smoke_mat smoke_sys.amount = 32 smoke_sys.lifetime = 1.0 smoke_sys.position = Vector3(0, 0, 0.0) add_child(smoke_sys)