Blazed Games
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Blazed Games

Free computer games/software
 
HomeLatest imagesSearchRegisterLog in

 

 Level editor help

Go down 
2 posters
AuthorMessage
Bob-1100k

Bob-1100k


Posts : 63
Join date : 2008-03-29
Age : 29
Location : SA, Australia

Level editor help Empty
PostSubject: Level editor help   Level editor help EmptyWed Apr 16, 2008 8:28 pm

I'm making a level editor for my Pacman game and no I didn't copy cwarn23 I started making this before he posted his.

All the components are working except for the Saving and Loading of the instance positions.

I have not much experience in saving to a file and reading from a file.

I need all the instances to save a file with their coordinates and id so when you load it each instance should take on the id and position saved.

I found a save replays tutorial on the internet HERE and I tried to maniplate it to work for me.

This is my save code:

Quote :
//Which objects to draw
nr_obj = 3; //How many objects
obj_d[0] = Pacman;
obj_d[1] = Ghost;
obj_d[2] = Block;




i = 0;
d = 0;
while(i<instance_number(obj_d[d]))
{
//Selecting information
x_id = (instance_find(obj_d[d],i).x);
y_id = (instance_find(obj_d[d],i).y);

file = file_text_open_append(object_get_name(object_index)
+string(instance_find(obj_d[d],i)));
file_text_writeln(file);
file_text_close(file);

i +=1;
}
if (i==instance_number(obj_d[d]))
{
d += 1;
i = 0;
}

This is my load code:
Quote :

y = file_text_read_string("Block100597");
//file_text_writeln("Block100597");
x = file_text_read_string("Block100597");
//file_text_writeln("Block100597");


file = false;
file_r = file_find_first(working_directory+"*.*",fa_archive)
while(file==false)
{
if (string_pos("rev_"+string(object_get_name(object_index)),file_r))
{
file = true;
}
if (file==false)
{
file_r = file_find_next();
}
if (file_r=="")
{
file = true;
show_message("Couldn't find a file for this object");
}
}

All help will be appreciated.
Back to top Go down
santa22

santa22


Posts : 70
Join date : 2008-03-29
Age : 34
Location : unabletosaywhere

Level editor help Empty
PostSubject: Re: Level editor help   Level editor help EmptyWed Apr 16, 2008 8:47 pm

y not use INI files?
Back to top Go down
http://www.godbattles.i8.com
Bob-1100k

Bob-1100k


Posts : 63
Join date : 2008-03-29
Age : 29
Location : SA, Australia

Level editor help Empty
PostSubject: Re: Level editor help   Level editor help EmptyWed Apr 16, 2008 11:44 pm

I don't know how to use them. I have limited knowledge about that sort of stuff. Like I said before I have not much experience in saving to a file and reading from a file.
Back to top Go down
Sponsored content





Level editor help Empty
PostSubject: Re: Level editor help   Level editor help Empty

Back to top Go down
 
Level editor help
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Blazed Games :: General/Resources :: Off topic-
Jump to: