heh no i mialem do pliku txt i tez nie działało
GML (zapis)
var file, str;
//Open file for writing
file = file_text_open_write("Level.txt");
/*
//Create player string
str = string(obj_Player.x) + "|" + string(obj_Player.y) + "|";
//Write player string and go to a new line
file_text_write_string(file, str);
file_text_writeln(file);
*/
//Reset string var
str = "";
//Write wall objects to file
with (obj_block)
{
str += string(x) + "|" + string(y) + "|" + string(image_index) + "|";
}
file_text_write_string(file, str);
file_text_close(file);
effect_create_above(ef_smokeup,view_xview+view_wview/2,view_yview+view_hview/2,5,c_green)
GML (wczytanie)
var file, str, str_pos, str_temp, val, num;
file = file_text_open_read("level.txt");
if file != -1
{
/*
str = file_text_read_string(file);
file_text_readln(file);
str_pos = 1;
num = 0;
str_temp = "";
while(str_pos < string_length(str))
{
while (string_char_at(str, str_pos) != "|")
{
str_temp += string_char_at(str, str_pos);
str_pos += 1;
}
val[num] = real(str_temp);
str_pos += 1;
num += 1;
str_temp = "";
}
instance_create(val[0], val[1], obj_Player);
*/
with(obj_block)instance_destroy()
str = file_text_read_string(file);
str_temp = "";
num = 0;
str_pos = 1;
while(str_pos < string_length(str))
{
while (string_char_at(str, str_pos) != "|")
{
str_temp += string_char_at(str, str_pos);
str_pos += 1;
}
val[num] = real(str_temp);
str_temp = "";
str_pos += 1;
num += 1;
if num = 3
{
num = 0;
with (instance_create(val[0], val[1], obj_block))
{
image_index=val[2]
}
}
}
file_text_close(file);
}