How to draw a timer

mattsgames21

  • Posts: 43
Is there a tutorial anywhere that explains how to do the following ...

Draw text that states: "Next train coming in 3 minutes" with the "minutes" being drawn in numbers?

Please forgive me for the questions; I have a medical condition that causes blurred vision throughout the day and it makes it hard for me to scan the internet looking for solutions to read.  But I haven't found a tutorial specific to this case.

Thank you

merrak

  • *
  • Posts: 2675
Here's my code for a timer, and also what the output looks like.

mattsgames21

  • Posts: 43
Thank you Merrrak. I'll take a look tomorrow when my vision is feeling better.

mattsgames21

  • Posts: 43
Hello everyone,

I digested the information regarding the timers.

I have an additional question regarding timers.

I want to draw a timer on the screen that counts down the time to when an actor is appearing. This will occur with different actors and each actor will have a different time. Should I approach that problem by creating different timer actors or is there a way that a scene event can be applied to all of them with changing times? I don't seem to see a path forward by creating a scene timer.

Luyren

  • *
  • Posts: 2645
https://luyren.itch.io/luyrens-miscellaneous-stencyl-behaviors
This resource pack has a timer scene behavior. You can customize as many timers as you want and use custom blocks to call and modify them, so you could use that to call specific timers for each of your actors. This might be over-engineered for your needs, and you'd still need to create your own code to get each timer and do stuff when they reach 0.

If you want to have the scene handle the timers, the easiest way would be to have a list of timers and call them individually.  If you want an actor solution, you could make a "actor spawner" actor type (make it invisible if you need), give it a single timer behavior, and when that timer is up, create your desired actor in its place.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.
Twitter

mattsgames21

  • Posts: 43
Thank you Luyren. I will take a look. I am making good progress on my game. I appreciate all of your help.