Post by Tom Mulgrew on Feb 26, 2008 1:15:32 GMT -5
also could u help me produce a game tom mulgrew im new im only 14 but i really want to make a video game if u have time can u help me learn basic4GL language i also have a story for a game and am ready to make one i need somone like u to help me actually make a game if u have time thanx
I'm afraid I'm already pretty busy. You might be able to find someone else in the forum to team up with though.. (I'll happily answer questions though).
' Move camera while SyncTimer (10) if ScanKeyDown (VK_LEFT) then camAng# = camAng# + 1: endif if ScanKeyDown (VK_RIGHT) then camAng# = camAng# - 1: endif if ScanKeyDown (VK_UP) then camX# = camX# - sind (camAng#) * .5 camZ# = camZ# - cosd (camAng#) * .5
endif if ScanKeyDown (VK_DOWN) then camX# = camX# + sind (camAng#) * .5 camZ# = camZ# + cosd (camAng#) * .5
endif struc BGM_Vertex dim v# (2) ' Vertex position dim t# (1) ' Texture coordinates endstruc
struc BGM_PolyVertex dim vertexIndex, normIndex endstruc
struc BGM_Poly dim firstVertex, vertexCount endstruc
struc BGM_Model dim vertexCount, BGM_Vertex &vertex() dim normCount, &norm#()() dim polyVertexCount, BGM_PolyVertex &polyVertex() dim polyCount, BGM_Poly &poly() dim scale# dim displayList endstruc
' Working dim BGM_Model &model, BGM_Poly &poly, BGM_PolyVertex &polyVertex, BGM_Vertex &vertex dim dir$, fileName$, file, i, i2
LoadBGM: file = OpenFileRead (dir$ + fileName$) if FileError () <> "" then print FileError (): end: endif
alloc model model.scale# = 1
' Vertices model.vertexCount = ReadInt (file) alloc model.vertex, model.vertexCount for i = 0 to model.vertexCount - 1 for i2=0 to 2: model.vertex (i).v#(i2)=ReadFloat (file): next for i2=0 to 1: model.vertex (i).t#(i2)=ReadFloat (file): next next
' Normals model.normCount = ReadInt (file) alloc model.norm#, model.normCount, 2 for i = 0 to model.normCount - 1 for i2=0 to 2: model.norm# (i)(i2)=ReadFloat (file): next next
' Poly vertices model.polyVertexCount = ReadInt (file) alloc model.polyVertex, model.polyVertexCount for i = 0 to model.polyVertexCount - 1 model.polyVertex (i).vertexIndex = ReadInt (file) model.polyVertex (i).normIndex = ReadInt (file) next
' Polygons model.polyCount = ReadInt (file) alloc model.poly, model.polyCount for i = 0 to model.polyCount - 1 model.poly (i).firstVertex = ReadInt (file) model.poly (i).vertexCount = ReadInt (file) next CloseFile (file) return
' Draw model glPushMatrix () glScalef (model.scale#, model.scale#, model.scale#) if model.displayList <> 0 then ' If a display list exists, use it glCallList (model.displayList) else
' Otherwise, create a display list, and render the model into it model.displayList = glGenLists (1) glNewList (model.displayList, GL_COMPILE_AND_EXECUTE)
for i = 0 to model.polyCount - 1 &poly = &model.poly (i) glBegin (GL_TRIANGLE_FAN) for i2 = 0 to poly.vertexCount - 1 &polyVertex = &model.polyVertex (poly.firstVertex + i2) &vertex = &model.vertex (polyVertex.vertexIndex) glNormal3fv (model.norm# (polyVertex.normIndex)) glVertex3fv (vertex.v#) next glEnd () next glEndList () endif
if u try this code u will see one box in a flash then the screen will have a purlple thing and it is stuck u cant move ur camera so take one of ur models and pace it where i want it which is in place of that yellow box then can you give me the code back so i can put my model in it and it will be cool if u can do that thanks
The file that you uploaded was called gun.obj but in your code the file is called gun.bgm. So I changed the filename in the code to gun.obj but when I ran the program it generated an error saying that the vertexCount variable is too big.
Your program didn't seem to be able to load the .obj file so I used the obj viewer that einlander wrote & I modified it a little. I was then able to get the gun displayed on the screen.
ty so much i just need to get that gun in a 3d perspective in my game and the code i gave u is the one where i wwant u to put thisa gun where the yellow box is once i get it there i can make some effects for it and stuff
Can anyone please upload your game made using Basic4gl in .gb files as a reference ?? Maybe , it can help Basic4gl users (besides me) know more about the way in setting up a game. Many of the demo games are in .exe form ..... T.T