Explosion_der_Spiele/scripts/combat/quirxel_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

40 lines
1.1 KiB
GDScript

extends Area3D
class_name QuirxelProjectile
## Flying pixel square that seeks / shoots toward the player (final boss).
var velocity: Vector3 = Vector3.ZERO
var lifetime: float = 6.0
var hp: 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("quirxel")
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.45)
if bill.has_method("set_texture"):
var tex: Texture2D = load("res://assets/sprites/placeholders/quirxel.png")
if tex:
bill.set_texture(tex)
func _physics_process(delta: float) -> void:
global_position += velocity * delta
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(1, "death_quirxel")
call_deferred("queue_free")