Bob-1100k
Posts : 63 Join date : 2008-03-29 Age : 29 Location : SA, Australia
| Subject: 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. | |
|
santa22
Posts : 70 Join date : 2008-03-29 Age : 34 Location : unabletosaywhere
| Subject: Re: Level editor help Wed Apr 16, 2008 8:47 pm | |
| | |
|
Bob-1100k
Posts : 63 Join date : 2008-03-29 Age : 29 Location : SA, Australia
| Subject: 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. | |
|
Sponsored content
| Subject: Re: Level editor help | |
| |
|