After you've deleted an element you really shouldn't use the list until you've called NextElement() again, as chances are that you'll have an empty list also you're wasing CPU time this way because you update the previous sprite one extra time for every element you delete...
So i would suggest something like this:
Code: Select all
Procedure UpdateSmoke()
If CountList(Smoke()) <> 0
ResetList(Smoke())
NextElement(Smoke())
Start3D()
While NextElement(Smoke())
Smoke()\X + Smoke()\XS-1
Smoke()\Y + Smoke()\YS-1
Smoke()\Size + 4
Smoke()\Trans - 4
If Smoke()\trans < 1
DeleteElement(Smoke())
Continue
EndIf
ZoomSprite3D(1,Smoke()\Size,Smoke()\Size)
RotateSprite3D(1, Smoke()\R, 1)
DisplaySprite3D(1,Smoke()\X+ShakeX,Smoke()\Y+ShakeY,Smoke()\Trans)
Wend
RotateSprite3D(0,GetMouseAngle(),0)
DisplaySprite3D(0,PlayerX-(SpriteWidth(0)/2)+ShakeX,PlayerY-(SpriteHeight(0)/2)+ShakeY)
Stop3D()
EndIf
EndProcedure
Procedure UpdateBullets()
If CountList(Bullet()) > 0
ResetList(Bullet())
Start3D()
While NextElement(Bullet())
Bullet()\X + Bullet()\XS
Bullet()\Y + Bullet()\YS
If Bullet()\X > (1024+16) Or Bullet()\X < -16
DeleteElement(Bullet())
Continue
EndIf
If Bullet()\Y > (768+16) Or Bullet()\Y < -16
DeleteElement(Bullet())
Continue
EndIf
RotateSprite3D(PlayerWeapon,Bullet()\Angle,0)
DisplaySprite3D(PlayerWeapon,Bullet()\X,Bullet()\Y)
Bullet()\SC - 1
If Bullet()\SC < 0
Bullet()\SC = 0
EndIf
If Bullet()\SC = 0
Bullet()\SC = Bullet()\SCS
AddSmoke(Bullet()\X-10,Bullet()\Y-10,-Bullet()\XS,-Bullet()\YS)
EndIf
Wend
Stop3D()
EndIf
EndProcedure