Oops! Dodgy Random Numbers with Deltatime

BlitzMax Forums/BlitzMax Programming/Oops! Dodgy Random Numbers with Deltatime

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

In my games, what I do is rather than have at all times some percentage chance of an action occuring, each time the action occurs, I calculate right then the next time it will occur and then just wait for that time to come around.

So let's say I have my aliens dive at the player. When that occurs, I just store NextDiveTime = Time + Rand(5000, 10000) and then I simply check each frame to see if Time >= NextDiveTime.