Hello everyone,
I have a question how do I program the game by using a countdown timer for areas (A, B, and C) with different rates for each area? (Visual scripting is preferable)
For example : Area A rate = 3 per second Area B rate = 1.5 per second Area C rate = 1 per
Timers are best implemented as a float variable that you update.
Collections (such as Dictionaries and Lists) can organize collections of these, such as one for each different level.
More reading:
Cooldown timers, gun bullet intervals, shot spacing, rate of fire:
This is commonly called a "cooldown timer." You can google for examples and tutorials, but the simplest way is this:
have a private float gunHeat; variable
In Update(), if that variable is greater than zero, subtract Time.deltaTime from it (this cools down the gunHeat)
if (gunHeat > 0)
{
gunHeat -= Time.deltaTime;
}
When you go to fire:
--- A. only fire if that gunHeat variable is zero or less.
--- B. set that variable to the time (in seconds) you want to have between shots.
if (Us…
GunHeat (gunheat) spawning shooting rate of fire:
Don’t use a Timer… that’s super overkill.
Instead, use just a float. I like to call my float “gunHeat.”
private float gunHeat;
private const float TimeBetweenShots = 0.25f; // seconds
Now… in Update():
// cool the gun
if (gunHeat > 0)
{
gunHeat -= Time.deltaTime;
}
// is the player asking to shoot?
if (PlayerAskedToShoot)
{
// can we shoot yet?
if (gunHeat <= 0)
{
// heat the gun up so we have to wait a bit before shooting again
gunHeat = TimeBetweenShots;
// DO…
If you want visual scripting, check this forum: