Spawn and despawn timing skill issues

Godot Version

4.2.2

Question

I have coded a function that allows an item to spawn and despawn within a certain time. The spawn time is set to 5 seconds, while the despawn is set to 2.5 seconds. However, it instead spawns every 2.5 seconds. (assuming this is due to the spawn timer running repeatedly instead of stopping when the despawn timer starts).

How can I ensure that the spawn time is consistently 5 seconds?

powerup script

main script start

powerup

powerup instantiate

If you place some print statements in your code you can track how things are being called and how often.

Then again, I ended up not using timers as they made my code harder to debug and ended u using await get_tree().create_timer(5).timeout instead.

By placing that and some print statements in my code I was able to debug and adjust things to my liking. With gaming, the fine tuning is really important.

The spawn time set to 7.5 seconds

Thanks mate, I’ll be sure to consider printing to debug in the future!

1 Like

No problem mate. Are you in Australia too? :laughing:

Nah, Indonesian. I tend to change speech mannerisms at random…

1 Like