cooldown effect

Started by
1 comment, last by BeerNutts 11 years, 10 months ago
hey,
i was wondering how to make the cooldown effect used in games like wow after you use an ability
does anone have an idea using c++ ?
Advertisement
The simplest method is to associate a "cooldown counter" to the ability/feature. It can represent the percentage value of the cooldown.

You check when you update the game. If the cooldown counter is 100% full, you can use the ability. If you use the ability (and the counter is at 100% of course), set the cooldown counter to zero, and in every update, increase the counter with a time dependent value until it reaches 100 again.
You can even use this percentage value to render the cooldown effect.


Details depend very heavily the actual implementation of the game (even based of continuously updated, etc.)
Or, a simplified method would be to associate a time the ability can be executed, in Milliseconds. So, once the player uses the ability, you add the current time to the cooldown time, and store it as the cooldown counter. Then, that ability can't be used until the current time is at or past the cooldown time.

szecs method is good for displaying on-screen how much time is left for that cooldown, but it adds more complexity to the implementation.

My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

This topic is closed to new replies.

Advertisement