abbayedesmorts-godot/scripts/cup.gd

30 lines
721 B
GDScript

extends Area2D
var active = 0
var removecup = 0
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
$Sprite2D.visible = false
$CollisionShape2D.disabled = true
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
if active == 1:
# Show
$Sprite2D.visible = true
$CollisionShape2D.disabled = false
if Global.room24 == 0:
$AudioStreamPlayer.play()
active = 2
if removecup == 1:
# Remove
$Sprite2D.visible = false
$CollisionShape2D.disabled = true
$"../satan".death = 1
removecup = 2
func _on_body_entered(body: Node2D) -> void:
if body.is_in_group("player") and active == 2:
removecup = 1