28 lines
773 B
GDScript
28 lines
773 B
GDScript
extends Area2D
|
|
|
|
signal diambil
|
|
|
|
@onready var anim_player: AnimationPlayer = $AnimationPlayer
|
|
@onready var collision: CollisionShape2D = $CollisionShape2D
|
|
|
|
func _ready() -> void:
|
|
if anim_player and anim_player.has_animation("gerak"):
|
|
anim_player.play("gerak")
|
|
|
|
func _on_body_entered(body: Node2D) -> void:
|
|
if body is Player:
|
|
# Panggil fungsi aktifkan power up di Player kamu
|
|
if body.has_method("aktifkan_triple_shot"):
|
|
body.aktifkan_triple_shot()
|
|
print("🔥 Power Up Triple Shot Aktif!")
|
|
|
|
emit_signal("diambil")
|
|
set_responsif(false)
|
|
|
|
func set_responsif(status: bool) -> void:
|
|
visible = status
|
|
if collision:
|
|
collision.set_deferred("disabled", !status)
|
|
if status and anim_player and anim_player.has_animation("gerak"):
|
|
anim_player.play("gerak")
|