Havent really gotten around to makin' a 3d game in Blitz3d, so I decided to make somethin simple that I could actually work one, which I've based off a lil' mini-game in Sly2 (for PS2) which involved moving a tank around a map being able to fire rounds off in 360 degrees blowing up enemies, while shooting out barriers to finish the area, or hit a switch to open up a passage to another area...
Anyway, I havent gotten pretty far in the project which I probably will never get around to finishing, but the fact I cant figure out why my tank (or its pivot at least) wont move is startin to bug me........anyone able to scan through my (messy) code see anything wrong here?
The only thing I can think of is that the problem might involve the use of CopyEntity() for creating my tank with.....
Anyway, I havent gotten pretty far in the project which I probably will never get around to finishing, but the fact I cant figure out why my tank (or its pivot at least) wont move is startin to bug me........anyone able to scan through my (messy) code see anything wrong here?
AppTitle "Tanky" Graphics3D 640,480,0,2 ;// Create the camera, .....why did I even comment that? Global cam = CreateCamera() PositionEntity cam, 0,20,-5 RotateEntity cam,75,0,0 ;// Two parts to my lil' tank figures, the body, and the turret on top Global tankbody = LoadMesh("tank.3ds") HideEntity tankbody RotateEntity tankbody,90,0,0 Global tankturret = LoadMesh("turret.3ds") HideEntity tankturret RotateEntity tankturret,90,0,0 ;// Create a plane and texture it so I aint starin into space 24/7 grid = LoadTexture("tile.png") plane = CreatePlane() EntityTexture plane, grid ;// Control : 1 = Player, 2 = AI, body = model for body, turret = turret, ;// currdir = current direction, bodydir = direction it should be at ;// pivot = the thing that actually moves around Type tanky Field control, body, turret, currdir, bodydir, pivot End Type ;// Create Tank for player CreateTank(1,0,0,0) While Not KeyHit(1) UpdateTank() UpdateWorld RenderWorld ;// Check the whereabouts of my tank's pivot t.tanky = First tanky Text 0,0, "PlayerTank's X-Pivot @ " +EntityX(t.tanky\pivot) Text 0,10, "PlayerTank's Z-Pivot @ " +EntityZ(t.tanky\pivot) Wend End Function CreateTank(kind, x, z, dir) t.tanky = New tanky t.tanky\control = kind t.tanky\pivot = CreatePivot() t.tanky\body = CopyEntity(tankbody,t.tanky\pivot) t.tanky\bodydir = dir t.tanky\turret = CopyEntity(tankturret,t.tanky\body) If kind = 1 ;// If the tank is for player, color the tank, and make camera follow it EntityColor t.tanky\body,0,255,0 EntityColor t.tanky\turret,0,200,0 EntityParent cam, t.tanky\pivot EndIf PositionEntity t.tanky\body, x, 0.5, z End Function Function UpdateTank() For t.tanky = Each tanky If t.tanky\control = 1 If KeyDown(17) ;// W MoveEntity t.tanky\pivot,0,0,0.1 ElseIf KeyDown(31) ;// S MoveEntity t.tanky\pivot, 0,0,-0.1 EndIf If KeyDown(30) ;// A MoveEntity t.tanky\pivot, -0.1,0,0 ElseIf KeyDown(32) ;// D MoveEntity t.tanky\pivot, 0.1,0,0 EndIf EndIf Next End Function
The only thing I can think of is that the problem might involve the use of CopyEntity() for creating my tank with.....