Advertisement
AQtun

Ailment Timer

Sep 4th, 2024 (edited)
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. const float AILMENT_TICK_FREQUENCY = 0.02f; // 50 updates per second
  2. float ailmentTime;
  3.  
  4. void UpdateLoop(float dt)
  5. {
  6.   ailmentTime += dt;
  7.   while (ailmentTime >= AILMENT_TICK_FREQUENCY) {
  8.     ailmentTime -= AILMENT_TICK_FREQUENCY;
  9.     AilmentTick();
  10.   }
  11. }
  12.  
  13. void AilmentTick()
  14. {
  15.   // do your ailment logic in here
  16.   // ailments could have duration in ticks, so a bleed with duration of 75 ticks is equal to 1.5s
  17.   // it would guarantee consistent results when it comes to damage output
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement