Explosion_der_Spiele/scripts/combat/shoe_projectile.gd
copilot 1cc8aa9b9d Add village 3D wiring, voice lines, and 1.74 m world scale.
Houses ~8.5 m; chimps capped ~0.85 m with safer axis fitting. Large GLB/PBR packs stay local until Git LFS (Forgejo HTTP 413).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-15 12:02:57 +02:00

48 lines
1.3 KiB
GDScript

extends Area3D
class_name ShoeProjectile
## Thrown shoe from Schuhmacher Reif. Hit = damage / death_shoe.
var velocity: Vector3 = Vector3.ZERO
var lifetime: float = 4.5
var hp: int = 1
var damage: int = 1
func _ready() -> void:
collision_layer = 4
collision_mask = 2
monitoring = true
body_entered.connect(_on_body)
add_to_group("enemy")
add_to_group("shoe_projectile")
var bill := get_node_or_null("BillboardSprite")
if bill:
if bill.has_method("set_target_height"):
bill.set_target_height(SpriteFit.WORLD_PROP_HEIGHT * 0.75)
if bill.has_method("set_texture"):
var tex: Texture2D = load("res://assets/sprites/placeholders/shoe.png")
if tex:
bill.set_texture(tex)
func _physics_process(delta: float) -> void:
# Slight arc
velocity.y -= 6.0 * delta
global_position += velocity * delta
if global_position.y < 0.15:
global_position.y = 0.15
velocity.y = absf(velocity.y) * 0.25
velocity.x *= 0.85
velocity.z *= 0.85
lifetime -= delta
if lifetime <= 0.0:
call_deferred("queue_free")
func take_hit(_amount: int = 1) -> void:
hp -= 1
AudioDirector.play_hit()
if hp <= 0:
call_deferred("queue_free")
func _on_body(body: Node3D) -> void:
if body.is_in_group("player"):
GameState.take_damage(damage, "death_shoe")
call_deferred("queue_free")