Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //First define your objects
- //IE object[ 0 ] = objWall1; object[ 1 ] = objWall2;
- //Then create your map.txt or whatever you want to call the file
- //Should look something like this: 0,0,0|0,64,96|
- //So every object should be represented by TYPE,X,Y|
- {
- var i,f,text,char,mode,xx,yy,ob,object;
- object[ 0 ] = objWall;
- f = file_text_open_read( 'map.txt' );
- text = file_text_read_string( f );
- file_text_close( f );
- i = 1;
- mode = 0;
- xx = '';
- yy = '';
- ob = '';
- repeat( string_length( text ) )
- {
- char = string_char_at( text , i );
- if char == ',' or char == '|'
- {
- mode = mode + 1;
- if mode > 2
- {
- instance_create( real( xx ) , real( yy ) , object[ real( ob ) ] );
- xx = '';
- yy = '';
- ob = '';
- mode = 0;
- }
- }
- else
- {
- if mode == 0
- {
- ob = ob + char;
- }
- else if mode == 1
- {
- xx = xx + char;
- }
- else if mode == 2
- {
- yy = yy + char;
- }
- }
- i = i + 1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement