Hi All...
I took the Particles Explosion Example that comes with AppGameKit and modified it a bit in a way that seems to have uncovered a bug... but I wanted to be sure.
I'm sending particles up to the right, and shortly after, a strong force reverses their direction.
It repeats.
The bug is that the particle system changes. I believe that each iteration of the explosion should look essentially the same, but you will notice that either the initial force is diminished, or the opposing force is kicking in earlier...
You will see that they go past the right side of the screen, but in just a few cycles don't come even close.
It would be great to have more eyes on this. Let me know what you think:
// explosions with particles
// set a virtual resolution
SetVirtualResolution ( 320, 480 )
// load an image for the particles
LoadImage ( 1, "shrapnel3.png" )
// create particles off screen
CreateParticles ( 1, -100, -100 )
// set fire variable to 1
fire = 1
// main loop
do
// fire when ready
if ( fire = 1 )
// set up particles
SetParticlesPosition ( 1, 160, 240 )
ResetParticleCount ( 1 )
SetParticlesFrequency ( 1, 250 )
SetParticlesLife ( 1, 3.0 )
SetParticlesSize ( 1, 64 )
SetParticlesStartZone ( 1, -20, 20, 20, -20 )
SetParticlesImage ( 1, 1 )
SetParticlesDirection ( 1, 110, -110 )
SetParticlesAngle ( 1, 30 )
SetParticlesVelocityRange ( 1, 1.0, 2.0 )
SetParticlesMax ( 1, 300 )
AddParticlesColorKeyFrame ( 1, 0.0, 0, 0, 0, 0 )
AddParticlesColorKeyFrame ( 1, 0.5, 255, 255, 0, 255 )
AddParticlesColorKeyFrame ( 1, 2.8, 255, 0, 0, 0 )
AddParticlesForce ( 1, 0.1, 2.8, -250, 250 )
// reset fire value
fire = 0
endif
// when the explosion has finished it is safe to fire once more
if ( GetParticlesMaxReached ( 1 ) )
fire = 1
endif
// update the screen
sync ( )
loop