Terrain Function

BlitzMax Forums/MiniB3D Module/Terrain Function

FBEpyon(Posted 2008) [#1]
Im trying to work on a new Terrain Mesh, but its giving me a error, but I can't figure out whatz wrong.

Type Terrain

	Field Mesh:TMesh,Surf:TSurface
	Field Gridx:Int, Girdy:Int, Scale:Float
	Field X:Float, Y:Float, Z:Float
	Field vex_array:TSurface[128,128]
	
	'This sets up the terrain, but Width/Height maxs out at 128
	Function Create:Terrain(Width:Int,Height:Int,S:Int)
	
		T:Terrain = New Terrain
		
		Mesh=CreateMesh()
		Surf=CreateSurface(Mesh)
		
		Scale = S
		
		Girdx=Width
		Girdy=Height
		
		For x:Int = 0 To Gridx ; For y:Int = 0 To Girdy
		
			vex_array[x,y]=AddVertex(Surf,x,y,x/gridx,y/gridy)
		
		Next ; Next
		
		For x:Int = 0 To Gridx-1 ; For y:Int = 0 To Gridy
		
			AddTriangle(Surf,vex_array[x+1,y],vex_array[x,y],vex_array[x,y+1])
			AddTriangle(Surf,vex_array[x+1,y],vex_array[x,y+1],vex_array[x+1,y+1])
		
		Next ; Next
	
	End Function

End Type


please look thru let me know..

Im getting "Epression of type 'Int' cannot be indexed" on the vex_array[?,?] can you let me know why..?


klepto2(Posted 2008) [#2]
1. Use superStrict or at least Strict at top of your app.
2. You haven't declared vex_array, not correct. You have declared it as an array of TSurface but it should be int.
3. Check your spelling. One time it is Girdy next it is Gridy.
4. This could be avoided using 1.


FBEpyon(Posted 2008) [#3]
Thank I didn't notice the miss spelling sorry

I got it fixed now thanks alot you where a big help!!!

Now I have a bigger problem it seems no matter what I do I can't get the graphics to show :(