new version:
changes to the sprite behaviors module SpriteEmitter type:
changes to the sprite behaviors module SpriteEmitter type:
Rem bbdoc: Set the number of seconds between updating particle alpha EndRem Method SetAlphaUpdateDelay(ad:Double) alphaUpdateDelay = ad EndMethod Rem bbdoc: Use this to put all sprites back into the emitter pool. EndRem Method RefreshPool() For Local loop:Int=0 To pool.length-1 pool[loop].SetAlpha(0) Next EndMethod Rem bbdoc: Set the number of seconds between emitting particles EndRem Method SetEmitDelay(ed:Double) emitDelay = ed EndMethod Rem bbdoc: Set the number of seconds between updating particles EndRem Method SetUpdateDelay(ud:Double) particleUpdateDelay = ud EndMethod Rem bbdoc: Updates the emitter and it's particles EndRem Method Update(time_elapsed:Double) totalTimeUpdated:+time_elapsed 'Print "te="+time_elapsed+" ed="+emitDelay+" le="+lastEmit+" ms="+MilliSecs() If lastEmit+(1000*emitDelay)<MilliSecs() Then Emit() lastEmit = MilliSecs() EndIf If lastParticleUpdate+(1000*particleUpdateDelay)<MilliSecs() Then UpdateSpritePositions() lastParticleUpdate = MilliSecs() EndIf If lastAlphaUpdate+(1000*alphaUpdateDelay)<MilliSecs() Then UpdateSpriteAlphas() lastAlphaUpdate = MilliSecs() EndIf EndMethod Rem bbdoc: Update the current alpha of the particle sprites. about: End Rem Method UpdateSpriteAlphas() For Local loop:Int=0 To pool.length-1 If pool[loop].GetAlpha()>0 Then pool[loop].SetAlpha(pool[loop].GetAlpha()-alphaDelta) EndIf Next End Method Rem bbdoc: Update the current position of the particle sprites by taking into account their current position, the velocity and the velocity angle. about: End Rem Method UpdateSpritePositions() For Local loop:Int=0 To pool.length-1 If pool[loop].GetAlpha()>0 Then pool[loop].UpdatePosition() UpdatingPosition(pool[loop]) EndIf Next End Method