Why doesn't this work correctly? I use the same timing system for many things in many of my programs, and yet here it seems broken.
Here is the relevant code:
The Relevant Part of the Debug Log Reads:
As can be seen, only one particle is emitted. Why? Why does the second exhaust generator's timer reset itself when it doesn't create the particle?
Here is the relevant code:
;CREATES NEW EXHAUST PARTICLES, MOVES AND FADES THE PARTICLES, AND EVENTUALLY DELETES THEM Function exhaust() ;since each ship gives off exhaust... For ship.ship = Each ship f = 0 ;finds the exhaust generators For exhaustGeneratorSpecs.exhaustGenerator = Each exhaustGenerator f = f + 1 DebugLog f + ": " + (worldtimer - (ship\exhaustGeneratorSpecs\timer + 1000)) ;if it's time to create a new exhaust particle, do so! If worldtimer > (ship\exhaustGeneratorSpecs\timer + 1000) ;creates the new particle exhaust.exhaust = New exhaust ;instead of loading it each time, copy it to the generator point exhaust\entity = CopyEntity(exhaustParticle, ship\exhaustGeneratorSpecs\entity) ;free's its child-hood so that it moves irrelevant of the ship EntityParent exhaust\entity, 0 exhaust\dx# = 0 exhaust\dy# = 0 exhaust\dz# = 0 exhaust\exhaustColor = 155 ;a nice hue EntityColor exhaust\entity, exhaust\exhaustColor + 100, exhaust\exhaustColor, 0 ship\exhaustGeneratorSpecs\timer = worldtimer DebugLog f + ": " + (worldtimer - (ship\exhaustGeneratorSpecs\timer + 1000)) EndIf Next Next ;finds each exhaust particle For exhaust.exhaust = Each exhaust ;moves the particle and has it's color fade MoveEntity exhaust\entity, exhaust\dx, exhaust\dy, exhaust\dz EntityColor exhaust\entity, exhaust\exhaustColor, exhaust\exhaustColor, 0 exhaust\exhaustColor = exhaust\exhaustColor - 10 ;if it's black, delete it. Duh. If exhaust\exhaustColor < 0 FreeEntity exhaust\entity Delete exhaust EndIf Next End Function
The Relevant Part of the Debug Log Reads:
1: -37 2: -37 1: -21 2: -21 1: -4 2: -4 1: 13 1: -1000 2: -1000 1: -984 2: -984
As can be seen, only one particle is emitted. Why? Why does the second exhaust generator's timer reset itself when it doesn't create the particle?