W
Wraithious
Guest
Hello, In my game I have an alarm event that makes a surface and draws stuff, then adds a sub image to a sprite from the surface, but it crashes the game hard (like crashes windows, no error message reported from game maker) so I ran it in the debugger and it crashes at the first call to sprite_add_from_surface. All other variables up to that point all have the correct/expected values, and I have added the sprites in the resource tree like normal, they are not imported from a file. Here is my alarm code:
Does anyone know what I might be doing wrong?
Code:
///Captain's log stardate 20171018 - Make pages
num=sprite_get_number(spr_content);
num2=sprite_get_number(invertNo);
num3=sprite_get_number(invertYes);
spr=sprite_create_from_surface(application_surface,0,0,736,414,0,0,0,0);
sur=surface_create(394,294);
surface_set_target(sur);
draw_clear_alpha(-1,0);
if(sprite_exists(spr))
{global.maxpage+=1;
draw_sprite_ext(spr,0,0,0,0.535,0.71,0,-1,1);
draw_set_color(c_white);
draw_text(191,278,"("+string(global.maxpage)+")");
surface_reset_target();
sprite_add_from_surface(spr_content, sur, 0, 0, 394, 294, 0, 0); //CRASHES windows here
sprite_add_from_surface(invertNo, sur, 0, 0, 197, 294, 0, 0);
sprite_add_from_surface(invertNo, sur, 197, 0, 197, 294, 0, 0);
surface_free(sur);
sur=surface_create(394,294);
surface_set_target(sur);
draw_clear_alpha(-1,0);
draw_sprite_ext(spr,0,0,0,0.535*-1,0.71,0,-1,1);
surface_reset_target();
sprite_add_from_surface(invertYes, sur, 197, 0, 197, 294, 0, 0);
sprite_add_from_surface(invertYes, sur, 0, 0, 197, 294, 0, 0);
surface_free(sur);
sprite_save_strip(spr_content, "spr_content.png");
sprite_save_strip(invertNo, "invertNo.png");
sprite_save_strip(invertYes, "invertYes.png");
}
Last edited by a moderator: