hi,
I'm having a problem with my bullets, When I turn my gun, the bullets don't follow...How do I make it follow?
Also! I did search the forums for the anwser, but I don't think I found it...
here is the code...
any help would be appreciated! thanks!
I'm having a problem with my bullets, When I turn my gun, the bullets don't follow...How do I make it follow?
Also! I did search the forums for the anwser, but I don't think I found it...
here is the code...
Graphics3D 640,480 SetBuffer BackBuffer() type_camera=1 type_entity=2 Function pause() Text 100,150, "Game Paused - press any key (except P or start) to continue" WaitKey() WaitJoy() End Function light=CreateLight() camera=CreateCamera() PositionEntity camera,1,1,0 CameraClsColor camera,92,236,222 EntityType camera, type_camera CameraRange camera,.001,1000 camera2=CreateCamera() PositionEntity camera2,0,1,-5 CameraClsColor camera2,92,236,222 CameraRange camera2,.001,1000 EntityType camera2,type_camera CameraViewport camera,0,0,GraphicsWidth()/2,GraphicsHeight() CameraViewport camera2,GraphicsWidth()/2,0, GraphicsWidth()/2,GraphicsHeight() camsphere=CreateSphere() EntityType camsphere,type_camera camsphere2=CreateSphere() plane=CreatePlane() EntityType plane, type_entity Ptex=LoadTexture("grass.jpg") EntityTexture plane,ptex mesh=LoadMesh("building1.b3d") PositionEntity mesh,0,.35, 10 ScaleEntity mesh,.05,.05,.05 EntityType mesh, type_entity ;EntityRadius mesh,-1 gun=LoadMesh("guns\\w_fiveseven.3ds") PositionEntity gun,1.1,.8,.3 ScaleEntity gun,.05,.05,.05 RotateEntity gun,90,-75,0 EntityParent gun,camera fullcart=100 Dim bullet(fullcart) For i=0 To fullcart bullet(i)=CreateSphere() EntityColor bullet(i),100,100,100 ScaleEntity bullet(i),0.2,0.4,0.2 HideEntity bullet(i) Next Collisions type_camera,type_entity,2,2 While Not KeyDown(1) If KeyDown(208) Then MoveEntity camera2,0,0,-.15 If KeyDown(200) Then MoveEntity camera2,0,0,.15 If KeyDown(203) Then MoveEntity camera2,-.15,0,0 If KeyDown(205) Then MoveEntity camera2,.15,0,0 If KeyDown(30) Then TurnEntity camera2,0,2,0,1 If KeyDown(32) Then TurnEntity camera2,0,-2,0,1 If KeyDown(31) Then TurnEntity camera2,2,0,0 If KeyDown(17) Then TurnEntity camera2,-2,0,0 If JoyXDir() = -1 MoveEntity camera,-.15,0,0 If JoyXDir() = 1 MoveEntity camera,.15,0,0 If JoyYDir() = -1 MoveEntity camera,0,0,.15 If JoyYDir() = 1 MoveEntity camera,0,0,-.15 ;If JoyXDir() = -1 TurnEntity camera,0,1,0 ;If JoyXDir() = 1 TurnEntity camera,0,-1,0 ;If JoyYDir() = -1 TurnEntity camera,-1,0,0 ;If JoyYDir() = 1 TurnEntity camera,1,0,0 ;If JoyDown(1) MoveEntity camera,-.1,0,0 ;If JoyDown(3) MoveEntity camera,.1,0,0 ;If JoyDown(4) MoveEntity camera,0,0,.1 ;If JoyDown(2) MoveEntity camera,0,0,-.1 If JoyDown(1) TurnEntity camera,0,2,0,1 If JoyDown(3) TurnEntity camera,0,-2,0,1 If JoyDown(4) TurnEntity camera,-2,0,0 If JoyDown(2) TurnEntity camera,2,0,0 ;If EntityY(camera) > 1.5 TranslateEntity camera,0,-1,0 If JoyHit(6) Then ShowEntity bullet(t) PositionEntity bullet(t),EntityX(gun,1),EntityY(gun,1),EntityZ(gun,1) EntityColor bullet(t),Rand(0,255),Rand(0,255),Rand(0,255) t=t+1 End If For q=0 To fullcart MoveEntity bullet(q),.3,.5,3 Next PositionEntity camsphere,EntityX(camera),EntityY(camera),EntityZ(camera) ;MoveEntity camsphere,0,0,0 PositionEntity camsphere2,EntityX(camera2),EntityY(camera2),EntityZ(camera2) ;PositionEntity gun,EntityX(camera),EntityY(camera),EntityZ(camera) ;MoveEntity gun,0,1,10 If EntityY(camera)<2.0 Then PositionEntity camera,EntityX(camera),2.0,EntityZ(camera) If EntityY(camera2)<2.0 Then PositionEntity camera2,EntityX(camera2),2.0,EntityZ(camera2) TranslateEntity camera,0,-.15,0 TranslateEntity camera2,0,-.15,0 RenderWorld UpdateWorld Text 0,0,EntityX(camera,True) Text 0,15,EntityY(camera,True) Text 0,30,EntityZ(camera,True) Text 600,0,EntityX(camera2,True) Text 600,15,EntityY(camera2,True) Text 600,30,EntityZ(camera2,True) If KeyDown(25) Then pause If JoyDown(10) Then pause Flip Wend End
any help would be appreciated! thanks!