18 lines
484 B
GDScript
18 lines
484 B
GDScript
extends Node3D
|
|
|
|
var exploding := false
|
|
@onready var anim: AnimationPlayer = %AnimationPlayer
|
|
|
|
func _on_trigger_body_entered(_body: Node3D) -> void:
|
|
if exploding: return
|
|
anim.play("explode")
|
|
exploding = true
|
|
|
|
func _anim_explode() -> void:
|
|
var scene := preload("res://enemies/explosive_car/explosion.tscn")
|
|
var explosion: Node3D = scene.instantiate()
|
|
explosion.global_position = global_position
|
|
explosion.scale *= 3.
|
|
get_tree().current_scene.add_child(explosion)
|
|
queue_free()
|
|
|