Blazed Games

Free computer games/software
 
HomeFAQSearchMemberlistUsergroupsRegisterLog in

Share | 
 

 Level editor help

Go down 
AuthorMessage
Bob-1100k

avatar

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

PostSubject: Level editor help   Wed 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
View user profile
santa22

avatar

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

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

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

avatar

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

PostSubject: Re: Level editor help   Wed 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
View user profile
Sponsored content




PostSubject: Re: Level editor help   

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: