Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Tile based engine
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
VB_User




PostPosted: Sun Apr 20, 2003 8:42 pm   Post subject: 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
Sponsor
Sponsor
Sponsor
sponsor
Martin




PostPosted: Sun Apr 20, 2003 10:01 pm   Post subject: (No subject)

code:

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




PostPosted: Sun Apr 20, 2003 10:04 pm   Post subject: (No subject)

The above is with binary files...otherwise:
code:

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




PostPosted: Sun Apr 20, 2003 10:27 pm   Post subject: (No subject)

hmm does this code work for u?
Dan




PostPosted: Sun Apr 20, 2003 11:16 pm   Post subject: (No subject)

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 Evil .

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.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: