hogwater
Member
Game is a 2d platformer.
OK, I have a pause feature that brings up a pause menu. My "confirm" button in the pause menu is the same as my "jump" button during gameplay. When I press "confirm" to exit the pause menu, my character instantly jumps upon exiting the menu (if he's in a char state with jumping allowed).
I believe that I need to clear my inputs somehow when closing the pause menu, but I've been unsuccessful so far, and I'm not really sure where or how to do this. Here's how the pause function works, as well as inputs:
Step event of my player char initiates the pause:
This creates a pause menu object. In its Create event:
This is what the "unpause" menu selection does:
Finally, this is how I collect the inputs from my "input manager object" in the step event of my player char:
Ideas?
OK, I have a pause feature that brings up a pause menu. My "confirm" button in the pause menu is the same as my "jump" button during gameplay. When I press "confirm" to exit the pause menu, my character instantly jumps upon exiting the menu (if he's in a char state with jumping allowed).
I believe that I need to clear my inputs somehow when closing the pause menu, but I've been unsuccessful so far, and I'm not really sure where or how to do this. Here's how the pause function works, as well as inputs:
Step event of my player char initiates the pause:
Code:
//pause that game my man
if (pause) && (!global.paused) && (can_pause)
{
global.paused = true;
var view_x = camera_get_view_x(obj_camera.camera);
var view_y = camera_get_view_y(obj_camera.camera);
var view_width = camera_get_view_width(obj_camera.camera);
var view_height = camera_get_view_height(obj_camera.camera);
instance_create_layer(view_x + ((view_width/5)*3),view_y + (view_height/4),"top_layer",obj_pause_menu);
audio_play_sound(snd_pause,0,0);
can_pause = false;
}
This creates a pause menu object. In its Create event:
Code:
//actual pausing
instance_deactivate_all(true);
instance_activate_object(obj_input);
instance_activate_object(obj_game_control);
instance_activate_object(obj_audio_control);
instance_activate_object(obj_display_control);
instance_activate_object(obj_debug_drawer);
This is what the "unpause" menu selection does:
Code:
//RESUME (unpause) option
if (menu_index == 5) && (confirm)
{
can_do = true;
instance_activate_all();
global.paused = false;
if (instance_exists(obj_harry))
{
with (obj_harry)
{
can_pause = true;
}
}
audio_play_sound(snd_unpause,0,0);
instance_destroy();
}
Finally, this is how I collect the inputs from my "input manager object" in the step event of my player char:
Code:
//get player input
left = obj_input.left_held;
right = obj_input.right_held;
down = obj_input.down_held;
up = obj_input.up_held;
run = obj_input.x_button_held;
jump = obj_input.a_button;
attack = obj_input.y_button;
attack_held = obj_input.y_button_held;
attack_release = obj_input.y_button_release;
attack2 = obj_input.b_button;
attack2_held = obj_input.b_button_held;
attack2_release = obj_input.b_button_release;
pause = obj_input.start_button;
pause_release = obj_input.start_button_release;
Ideas?