blitz3d projectile problem

admin

Administrator
Staff member
<b>I know this should be easy stuff but somehow I have lost the bullets my gun is suposed to be firing and icant figure what I did wrong. Thanks to anyone that will help</b><br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->Graphics3D 640,480<br />SetBuffer BackBuffer()<br />light=CreateLight()<br />type_player=1<br />type_ground=2<br />camera=CreateCamera()<br />PositionEntity camera,0,10,0<br />EntityType camera,type_player<br /><br />sky=CreateSphere(64)<br />FlipMesh sky<br />ScaleEntity sky,1000,1000,1000<br />PositionEntity sky,0,0,0<br />sky_tex=LoadTexture("sky.jpg")<br />EntityTexture sky,sky_tex<br />EntityFX sky,1<br /><br />terrain=LoadTerrain("mt.jpg")<br />ScaleEntity terrain,10,100,5<br />PositionEntity terrain,-500,0,-500<br />tex=LoadTexture("grass1.jpg")<br />ScaleTexture tex,50,50<br />EntityTexture terrain,tex<br />EntityType terrain, type_ground<br /><br />gun=LoadMesh("a3dshtgn.3ds")<br />guntex=LoadTexture("shtgn.jpeg")<br />EntityTexture gun,guntex<br />PositionEntity gun,-340,1,45<br />RotateMesh gun,10,177,360<br />EntityParent gun,camera<br />EntityType gun, type_player<br />EntityOrder gun,-1<br /><br /><br />fullcart=100<br />Dim bullet(fullcart)<br />For i=0 To fullcart<br />bullet(i)=CreateSphere()<br />EntityColor bullet(i) ,100,100,100<br />ScaleEntity bullet(i) ,0.2,0.4,0.2<br />HideEntity bullet(i)<br />Next<br /><br />While Not KeyDown(1)<br />x#=0<br />y#=0<br />z#=0<br /><br />If KeyHit(57) And reload=0 Then<br />ShowEntity bullet(T)<br />PositionEntity bullet(t) ,EntityX(camera,1),EntityY(camera,1),EntityZ(camera,1)<br />RotateEntity bullet(t),EntityPitch#(gun,1)-35,EntityYaw#(gun,1),EntityRoll#(gun,1)<br />t=t+1<br />EndIf<br /><br />For q=0 To fullcart<br />MoveEntity bullet(q),0,1,3<br />Next<br /><br />If KeyDown(203)=True Then x#=-0.5<br />If KeyDown(205)=True Then x#=0.5<br />If KeyDown(208)=True Then z#=-0.5<br />If KeyDown(200)=True Then z#=0.5<br />MoveEntity camera,x#,y#,z#<br /><br />Collisions type_player,type_ground,2,2<br />Collisions type_ground,type_player,2,2<br /><br />UpdateWorld<br />bulletcount=100-t<br /><br /><br />If t=100 Then<br />t=1<br />reload=1<br />EndIf<br /><br />If KeyDown(19)=True Then <br />t=1<br />reload=0<br />EndIf<br /><br />RenderWorld<br />Color 0,0,0<br />Text 2,100,"x= "+EntityX(camera)+" z= "+EntityZ(camera),False,False<br />Text 2,50,"x "+EntityX(gun)+" z "+EntityZ(gun),False,False<br />Text 0,15,"bullets Remaining: "+bulletcount<br />If reload=1 Then Text GraphicsWidth()/2,GraphicsHeight()/2,"press R to reload",1,1<br />Flip<br /><br />Wend<br /><br />End<br /><!--c2--></div><!--ec2-->
</div>
 
Back
Top