8
« on: August 25, 2015, 06:22:30 PM »
Well, there's too many shitty changes I've made, so I'm just going to explain how I've made it insteat of posting it here.
Changed code is this:
if (keyboard_check_pressed(global.pausebutton) && !global.noPause) {
global.pause = !global.pause;
if( global.pause ) {
instance_deactivate_all(true);
surface_copy(global.pause_surf,0,0,application_surface);
} else {
instance_activate_all();
}
}
So, I'm making a pause surface at the start of the game in variable initialization script and added a clear memory script to delete it if you press F2, but it'd be much better to not restart the game and ust move to the title again, because it does the same work all over again if you restart game. It'd be harder to make, I think, I didn't look into the whole code. Also, you need to add a check for a pause to not to increment time while paused. Oh, and I almost forgot to post draw GUI code of objWorld:
var str, off, th, tm, ts;
if(global.pause) {
draw_clear(c_black);
draw_surface_ext(global.pause_surf,0,0,1,1,0,c_white,0.5);
draw_set_color(c_white); //Font color
th = floor(global.time/(60*60));
tm = floor((global.time/60) mod 60);
ts = floor(global.time mod 60);
str = "Time: "+string(th)+":"+string(tm)+":"+string(ts);
off = view_hview - string_height(str)-8;
draw_text(8+string_width(str)/2,off,str);
str = "Deaths: " + string(global.death);
off = off - string_height(str)-8;
draw_text(8+string_width(str)/2,off,str);
str = "PAUSE";
draw_text(view_wview/2,view_hview/2,str);
}
Offsets maybe broken a bit, I've expected it to be drawn from a top-left corner and not from a center.