playMaker

Author Topic: Trigger Key Press?  (Read 1255 times)

Jule

  • Playmaker Newbie
  • *
  • Posts: 4
Trigger Key Press?
« on: January 16, 2023, 08:05:58 PM »
 ;D

Hello there.

My game is almost done. I just have some problems doing a working "Resume"Buttone from my pause menue.

I have watched several Youtube Videos, but honestly I don't have a single clue about coding and I was just trying to use Plamakers features.

I already have a pretty decend function of pausing the game and loading the menu screen by pressing ESC. (When I do this the game will commence (with the proper time-scale), the music that had stopped will play again and the menu will dissapear.

So I feel it might be the easiest to trick the game into thinking that ESC-was clicked when it was actually the "Resume-Button", because then the right events will automatically be triggered.

How can I do that exactly?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Trigger Key Press?
« Reply #1 on: January 17, 2023, 12:17:57 AM »
HI.
for a button you can use Ui Button On Click Event

Jule

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Trigger Key Press?
« Reply #2 on: January 17, 2023, 08:52:33 AM »
Yeah! Tried that.

The problem is (I think) that deactivating the menu-overlay results in deleting everything the button does. (I use the "Activate Game Object" Action for that) and thus I think the problem is that all the other actions are stopped immediatly when the menu is deactivated.

Meaning: I have an Action running to set the timescale back to normal, since the game was paused before
and
an "Activate Game Object"-action that enables the soundeffects again that I muted because they kept playing when you stopped the game.

When I use these actions alone without deactivating the main menue overlay everything works as intended. (Just that the game resumes with the main menue on the screen)

I tried for hours now to fix it. Even programmed a one-and-a-half-second delay for the menu to disappear from the screen because I hoped that this would solve my problem. - But that results in the game being still paused while only the menu screen left the screen.


So: In my eyes the easiest thing is to make the system think that ESC was pressed allthough it was the button, because I have a working method for that already. - But I don't know how to tell the button this.

The other method might be to put the actions for unpausing the games TimeScale and the sounds to another object outside of the menu and then making it know that the menu has been closed and that the game should be running now. But I did not find a way to do that either. :-P

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Trigger Key Press?
« Reply #3 on: January 17, 2023, 10:00:05 AM »
Hi.
for the "ESC" you use a 'Get Button Down' action?

Jule

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Trigger Key Press?
« Reply #4 on: January 17, 2023, 10:24:41 AM »
How do I do that exactly? I used the "get button down"-action so the system knows when ESC is clicked. How do I tell the system that it is clicked, when actually it wasn't even touched?

Jule

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Trigger Key Press?
« Reply #5 on: January 17, 2023, 11:00:17 AM »
Ah, I found another way to make my menu work (I use a button now instead of ESC that stays on screen), but still the question interests me. :-)

Thanks for your help up to this point! :-)

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Trigger Key Press?
« Reply #6 on: January 17, 2023, 11:42:53 PM »
Hi.
Well its hard to say without seeing your fsm setup