bullet mode help

Blitz3D Forums/Blitz3D Programming/bullet mode help

i fixed it mostly. i rewrote it with the differing types of bullets as there own seperate type list. heres the fix.

Function fire(src)
If src=1
For p.player=Each player
  LinePick EntityX(p\piv),EntityY(p\piv),EntityZ(p\piv),0,0,-1000
  If PickedEntity>0
   PositionEntity p\apiv,PickedX(),PickedY(),PickedZ()
  Else 
   PositionEntity p\apiv,0,0,-100
   MoveEntity p\apiv,0,0,-10000
  End If
  pnum=1-pnum
  If pnum=1 
   q=p\fpiv1
  Else q=p\fpiv2
  ;DebugLog "pnum "+pnum
  End If
  b.bullet=New bullet
   b\ent=LoadSprite("media\laser1.bmp",4,q)
   api_Beep(200,100)
   b\x=0
   b\y=0
   b\z=0
  PointEntity b\ent,p\apiv
  EntityParent b\ent,0
  EntityType b\ent,lazer
Next

Else If src=2
For e.enemy=Each enemy
  If e\firing=1
  b.bullet=New bullet
   b\ent=LoadSprite("media\laser2.bmp",4,e\ent)
   b\x=0
   b\y=0
   b\z=0
  PointEntity b\ent,e\apiv
  EntityParent b\ent,0
  EntityType b\ent,lazer
 End If
Next
End If
End Function

Function updatefire()
For b.bullet=Each bullet
 MoveEntity b\ent,0,0,-5
 For e.enemy=Each enemy
  If EntityCollided (e\ent,lazer)
   FreeEntity b\ent
   Delete b
   e\hp=e\hp-10
  End If 
 Next
Next
End Function


Function explosion()
For e.enemy=Each enemy
 If e\hp<1
   f.particle=New particle
   f\ent=CreateSprite(e\ent)
   f\x=0
   f\y=0
   f\z=0
   f\life=39
   f\tex=LoadAnimTexture("media\explosion.png",4,64,64,0,39)
   EntityTexture f\ent,f\tex,frame#
   ScaleSprite f\ent,50,50
   EntityParent f\ent,0
   EmitSound explosnd,f\ent
 EndIf
Next
End Function

Function missle()
For p.player=Each player
If p\missle>0
 p\missle=p\missle-1
  m.bullet=New bullet
   m\ent=CreateCube(p\ent)
   m\x=0
   m\y=0
   m\z=0
  ScaleEntity m\ent,15,15,15
  PointEntity m\ent,p\apiv
  EntityParent m\ent,0
  EntityType m\ent,lazer
End If
Next
End Function


Function updatemissle()
For m.bullet=Each bullet
If m<> Null
MoveEntity m\ent,0,0,10
 For e.enemy=Each enemy
    
   If EntityCollided (m\ent,enem)
     FreeEntity m\ent
     Delete m
     e\hp=e\hp-100
   End If
 Next
End If
Next
End Function




ignore the explosion function but anyway it seems to ignore the if m<> null check and gives me the error when the bullets collide with the saucers.

<edit> i fixed all the problems and will most likly give it to the community as an example.