ok here is my code...
ok, first, how would I make it so both cameras have a gun that shoot in the easist way, because it is not working out to well...
2nd, how would I orginize my code so everything is accessable, and 3rd, how do I turn my bullet codes into functions.
If anyone can answer any of these questions I would be most thankful!
thanks!
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 gun2=LoadMesh("guns\\w_fiveseven.3ds") ScaleEntity gun2,.05,.05,.05 RotateEntity gun2,90,-75,0 EntityParent gun2,camphere2 fullcart=5 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) EntityParent bullet(t),0 PositionEntity bullet(t),EntityX(gun,1),EntityY(gun,1),EntityZ(gun,1) RotateEntity bullet(t),EntityPitch#(camera,1),EntityYaw#(camera,1),EntityRoll#(camera,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 bulletcount=100-t ;Color 255,255,255 ;PositionEntity gun2,EntityX(camera2),EntityY(camera2),EntityZ(camera2) ;MoveEntity gun2,0,0,1 RenderWorld UpdateWorld Text 0,15, "bullets remaining: "+bulletcount Text 200,0,EntityX(camera,True) Text 200,15,EntityY(camera,True) Text 200,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
ok, first, how would I make it so both cameras have a gun that shoot in the easist way, because it is not working out to well...
2nd, how would I orginize my code so everything is accessable, and 3rd, how do I turn my bullet codes into functions.
If anyone can answer any of these questions I would be most thankful!
thanks!