Showing posts with label timer. Show all posts
Showing posts with label timer. Show all posts

Waiting for Godot

When I was writing my first game in Godot, I wanted to add some simple cut-scenes. First the scene fades in. After a few seconds the bad guy enters. Yet another few seconds later the spotlight turns on and shines on him. Etc, etc.

Of course, I could have made one big Animation that handles all of this, but I wanted something more modular. I also wanted to introduce delays in other parts of the game for cinematic or comical effects. I started adding many Timer elements to all my scenes for each delay and connecting their "timeout" signals to many functions in the code. But that was ugly, and not what I wanted. Basically, what I wanted was something like the "sleep(time)" function I know from other languages.

It turns out that there is a one-liner that gives you that behaviour (to some extent), but it is a one-liner with a lot of baggage.

Most popular posts in the last month: