Quantcast
Viewing all articles
Browse latest Browse all 6821

Handling random with delta time advice

@MuntyScruntFundle wrote:

Hi folks.

I have a sprite that moves around following a target, the target location is changed according to sprite proximity and the sprite direction vector is always calculated with Delta Time.

Now and then I'd like the sprite to jump to a completely different location, this is more for effect than anything.

So I would say If Random.Next(1,1000) = 1 Then....but this is obviously very dependent on system speed.

I can setup timers:
If LastTime + Interval

Can anyone suggest a more elegant way to achieve the same without creating multiple variables just to control one event?

Many thanks.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles