
-----------------------------------
VB_User
Sun Apr 20, 2003 8:42 pm

Tile based engine
-----------------------------------
Hey ive been working on trying to make a tile based game the past few days and cant seem to get the map loading from a text file working. I wanted to have the text file made up of numbers which represent different tiles. I was going to store each value in a 2 dimensional array since a map is 2 dimension (lxw). If anyone can show me some code to do this i would be greatful because i cant seem to get it working.

thanks

-----------------------------------
Martin
Sun Apr 20, 2003 10:01 pm


-----------------------------------

var m : int := 10 %the width
var n : int := 16 %the height
var grid : array 1..m, 1..n of int

var mapFile : int
open : mapFile, "awjgajw.awgjaiwe", read
read:mapFile, grid
close : mapFile


-----------------------------------
Martin
Sun Apr 20, 2003 10:04 pm


-----------------------------------
The above is with binary files...otherwise:

var grid : array 1..x, 1..y of int %X and Y defined beforehand

var ifstream : int
open : ifstream, "awgh.awegaw", get
for a:1..x
 for b:1..y
  get : ifstream, grid(a,b)
 end for
end for

Windows.Crash ()


-----------------------------------
VB_User
Sun Apr 20, 2003 10:27 pm


-----------------------------------
hmm does this code work for u?

-----------------------------------
Dan
Sun Apr 20, 2003 11:16 pm


-----------------------------------
well you do have to chage the file name and i dont know whats going on with that "Windows.Crash" stuff, i think drankness is having some fun there  :twisted: .

this just loads the data in to  the progame you need to read it and then deside what title to draw.

and of cores you need to have x and y  set to the diments (per title) and have a file that maches this.
