Godot:Timer
godot - a countdown Timer.
AutoStart Example
코드에서 별도로 시작할게 아니라면, Inspector 에서 꼭 Autostart
속성을 On
으로 설정해야 정상작동한다.
Signal 에서 timeout
이벤트를 연결해야 한다.
using Godot;
using System;
public class Piano : Node2D
{
// ...
private void _on_Timer_timeout()
{
GD.Print("Timer !!");
}
}
동적 타이머 생성
timer = Timer.new()
timer.set_one_shot(false)
timer.set_timer_process_mode(TIMER_PROCESS_FIXED)
timer.set_wait_time(0.6)
timer.connect("timeout", self, "_timer_callback")
timer.start()
add_child(timer) # <-------- 중요!
See also
- godot
- Godot:Signal - 신호 연결하는 방법
Favorite site
- Sync the gameplay with audio and music — Godot Engine (stable) 문서 (한국어) - 게임 플레이를 오디오 및 음악과 동기화