channel-switcher/games/platformer/existWhenGaming.gd

24 lines
544 B
GDScript3
Raw Permalink Normal View History

2025-05-17 14:21:38 +10:00
extends Control
var become_real : bool = false
var realness : float = 0
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
GameManager.gaming.connect(appear)
2025-05-17 16:24:38 +10:00
GameManager.game_over.connect(vanish)
2025-05-17 14:21:38 +10:00
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
if(become_real):
realness += delta/2
modulate = Color(1,1,1,clampf(realness, 0,0.5))
if(realness > 0.5):
become_real = false
func appear():
become_real = true
2025-05-17 16:24:38 +10:00
func vanish():
hide()