Posted: 3rd Oct 2011 16:45
I have this just before my main loop.

+ Code Snippet
REM ** Create particle explosion
ExplosionOneOn = 0
ExplosionForBricksOne = 10
explImage = LoadImage ( "shrapnel3.png" )
CreateParticles(ExplosionForBricksOne, -100, -100 )


And on keypress I do this.

+ Code Snippet
REM ** Explosion
if ExplosionOneOn = 0
    createExplosionOne(100,100)
endif


This is my createExplosionOne function.

+ Code Snippet
Function createExplosionOne(xpos, ypos)

    SetParticlesPosition(ExplosionForBricksOne, xpos, ypos )
    ResetParticleCount ( ExplosionForBricksOne )
    SetParticlesFrequency ( ExplosionForBricksOne, 250 )
    SetParticlesLife ( ExplosionForBricksOne, 1.0 )
    SetParticlesSize ( ExplosionForBricksOne, 32 )
    SetParticlesStartZone ( ExplosionForBricksOne, xpos, ypos, xpos+50, ypos+50 )
    SetParticlesImage ( ExplosionForBricksOne, explImage )
    SetParticlesDirection ( ExplosionForBricksOne, xpos, ypos )
    SetParticlesAngle ( ExplosionForBricksOne, 360 )
    SetParticlesVelocityRange ( ExplosionForBricksOne, 0.8, 2.5 )
    SetParticlesMax ( ExplosionForBricksOne, 250 )
    AddParticlesColorKeyFrame ( ExplosionForBricksOne, 0.0, 0, 0, 0, 0 )
    AddParticlesColorKeyFrame ( ExplosionForBrickOne, 0.5, 255, 255, 0, 255 )
    AddParticlesColorKeyFrame ( ExplosionForBricksOne, 2.8, 255, 0, 0, 0 )
    AddParticlesForce ( ExplosionForBricksOne, 2.0, 2.8, 25, -25 )
    ExplosionOneOn = 1
Endfunction


And inside my main loop I have this.

+ Code Snippet
if ( GetParticlesMaxReached ( ExplosionForBricksOne ) )
    ExplosionOneOn = 0
endif


I get this error:
Posted: 3rd Oct 2011 16:52
If I replace ExplosionForBricksOne with 1 in my function it works okay.
Posted: 3rd Oct 2011 18:18
Try putting GLOBAL in front of your variable declarations. I suspect that your function is creating new local variables.
Posted: 3rd Oct 2011 18:21
I think it's because you are calling a function and the variable needs to be global for the function to see it. Try declaring it as global, see if that works.

EDIT: Damn, Bursar, I turn around for 2 minutes and you ninja me!
Posted: 3rd Oct 2011 18:37
LOL. It's been a while
Posted: 3rd Oct 2011 20:32
Yes thats it...

Thanks