Bullets in arrays

Blitz3D Forums/Blitz3D Programming/Bullets in arrays

What sort of problems did you have.

I would use a type over an array for missiles/bullets myself =)

[Edit]
A little code snippet...

Global gMissNum=0
Global gTime=Millisecs()
Global gMissile=CreateCube()
PositionEntity gMissile,0,0,-1000; put template missile out of the way
Global gShip=LoadMesh("MySpaceshipMesh.b3d")

Type missiletype
Field mesh
End Type 

 
;and in the main loop
text 0,0,"Number of active missile types "+gMissNum

;then call this function once per frame

Function Update_Missiles()
If MouseDown(1) Or KeyDown(157)
If MilliSecs()-gTime>100 ;minumum delay between each missile fire
missile.missiletype=New missiletype
gMissNum=gMissNum+1
missile\mesh=CopyEntity(gMissile)
PositionEntity missile\mesh,EntityX(gShip),EntityY(gShip),EntityZ(gShip)+6;position missile at ships gun
gTime=MilliSecs()
EndIf
EndIf 

For missile.missiletype=Each missiletype
MoveEntity missile\mesh,0,0,2
If EntityZ(missile\mesh)>50 ;kill it when it goes out of view
FreeEntity missile\mesh
Delete missile
gMissNum=gMissNum-1
EndIf
Next 
End Function