M. Idrees
Member
Hi,
I want to save multiple surfaces at once in a loop but it doesn't working or I am doing it in a wrong way.
My code for saving the surfaces
It works if I don't change the filename string.
Thanks for your attention.
I want to save multiple surfaces at once in a loop but it doesn't working or I am doing it in a wrong way.
My code for saving the surfaces
GML:
if ( SAVE ){
location = get_save_filename("PNG Sequence|*.png", "filename" ); // eg location = "\temp\images\ball.png"
len = 0;
if ( location != "" ){
for ( i=0; i<ds_list_size(AREA); i++ ){
surf = ds_list_find_value( AREA, i );
draw_surface( surf, AREA_X1, AREA_Y1 );
if ( i == 0 ){
location = string_copy( location, 0, string_length(location)-4 ) + string(i) + ".png"; // eg at i = 0 [ location = "\temp\images\ball" + "0" + ".png" ] and so on to the end of the loop
len = string_length(location);
} else {
location = string_copy( location, 0, len-5 ) + string(i) + ".png"; // eg at i = 1 [ location = "\temp\images\ball" + "1" + ".png" ] and so on to the end of the loop
}
if ( surface_exists( surf ) ){
surface_save( surf, location ); // eg at i = 1 [ location = "\temp\images\ball1.png" ] and so on to the end of the loop
}
}
}
}
Thanks for your attention.
Last edited: