hi,
How can i make the main character don't move when a GUI is shown, I cannot set the GUI's visibillity as 'Pause game when shown' because my keycodes will not work then?
Do anybody know how to do this please?
As far as your keycodes not working, you can explicitly put specific keycodes in your on_key_press function before the line which reads:
if (IsGamePaused()) keycode = 0;
Other than that, you could put in your on_mouse_click function:
if (button == eMouseLeft) {
if (gPause.Visible) ProcessClick(mouse.x, mouse.y, mouse.Mode);
}
That will make it so that if the GUI gPause is shown then it won't interpret your mouse-clicks (clicks on the GUI are handled separately and would still work).
If you want him to stop moving in the event he was already moving but you turn the pause GUI on you would need to go with the first "Pause game" route to allow him to resume his movement when you resume the game. If you want the pause GUI to just cancel the movement you could do this in repeatedly_execute:
if (gPause.Visible) {
int i = 0;
while (i < Game.CharacterCount) {
if ((character[i].Room == player.Room) && (character[i].Moving)) character[i].StopMoving();
i++;
}
}
As noted, that would completely cancel the movement of all your characters on-screen when the pause GUI is shown.
Thank you very much, i used the last code.