Maths/Programming Help

Associate
Joined
18 Mar 2007
Posts
291
Hi all,

I am struggling a bit with a concept on how to implement some timings. The example I give below isn't actually what I'm trying to achieve, but is effectively the same. Imagining this is language independent, I'd like to know how you might go about the following:

- I have a machine gun
- At first, the machine gun should start firing bullets slowly (say 1 bullet every 3 seconds)
- Gradually over the course of a given time (say 5 minutes), the machine gun should start firing faster (i.e: there should be a ramp-up in it's firing time).
- Once the 5 minutes has been reached, the machine gun should be firing at full-throttle (say 3 bullets per second).

Has anybody got any hints or suggestions on how this could be achieved?

Thanks.
 
Associate
Joined
21 Dec 2005
Posts
576
Location
Felixstowe
Assuming this isn't the only thing happening I would set the machine gun up on a separate thread with a timer equal to the starting time between rounds. Then each time it activates reduce the timer by a set amount until it is the fastest you need.

eg timer =3000ms

timer = math.max(300,timer -15) each time it fires

PS that is a pretty slow machine gun
 
Back
Top Bottom