playMaker

Author Topic: [SOLVED] Using "Get Key" with Global Transition  (Read 3404 times)

AxelG

  • Playmaker Newbie
  • *
  • Posts: 34
[SOLVED] Using "Get Key" with Global Transition
« on: October 17, 2019, 10:16:21 AM »
Hello,

I'm testing for a game controller. I have a issue with a global transition set with a Get key (FSM screenshot attached).

I have a "Go Next" global transition linked to a button which work perfectly, I can click the button at any time and it will do the actions of the "Go Next" state.

My problem is that I'd like to link that action to a keyboard key too with a "Get Key down" and it doesn't work.

I tested on an other game object, it seems that it can't reach the global transition "Go Next" at any time like it does with a click on a button.
Note: The "Go Next" transition isn't linked to the "Start" Transition.

An other question: What would be the best workflow for a multiplatform app (Computer, Mobile and consoles)?

Shall I have everything in the same project or it is better to duplicate the scenes or the whole project?

Thanks,
AxelG
« Last Edit: October 19, 2019, 12:00:16 AM by AxelG »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: Using "Get Key" with Global Transition
« Reply #1 on: October 17, 2019, 02:11:52 PM »
Hi.
Can you show how/where you set up the 'get key down'.

AxelG

  • Playmaker Newbie
  • *
  • Posts: 34
Re: Using "Get Key" with Global Transition
« Reply #2 on: October 17, 2019, 07:09:57 PM »
Hey there,

I remade one, because I didn't save my previous config. I tried several one, counting one with just the "Get Key", a Start transition and an idle transition.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: Using "Get Key" with Global Transition
« Reply #3 on: October 18, 2019, 06:47:17 AM »
Hi.
on the image i can see that you have 2x the same global variable :



You should only have 1 global of the same name as it will conflict.
It can go only to one of the 2.

The bottom one where you have the 'Get Key Down' action will just go back to the same state.

I think you are misunderstanding how global transition work.

Maybe this video can help :


AxelG

  • Playmaker Newbie
  • *
  • Posts: 34
Re: Using "Get Key" with Global Transition
« Reply #4 on: October 18, 2019, 08:05:14 AM »
Hello,

I did watch this video already haha. In fact I just want to access the first "Go Next" Global Transition with an other key at any time.

I did change the first second Go Next to a new Global Transition, same result.
It seems I can only trigger Global Transitions with a click on a button, not with a keyboard key :S

ransomink

  • Playmaker Newbie
  • *
  • Posts: 44
Re: Using "Get Key" with Global Transition
« Reply #5 on: October 18, 2019, 10:17:20 AM »
Using GetKey works fine with global and regular transitions. It seems you're states and transition events are setup incorrectly. You can't have the same global event multiple times in an fsm, they will conflict and may fire one or the other randomly...

Only place one "Go Next" global event. Then have your GetKey action send the global event. That's all you need...

AxelG

  • Playmaker Newbie
  • *
  • Posts: 34
Re: Using "Get Key" with Global Transition
« Reply #6 on: October 18, 2019, 12:51:21 PM »
Hi,
I'm having hard time processing this one. I did change the Global Transition for the "Get key" event (new Global Transition named Go Next 2) but it is the same result.

It seems I can't access an event within the FSM with another event.
I'm probably missing something here, here's what I'd like to achieve:

- Have an event, that can be accessed with a button click and a keyboard key at any time.

For now only the first part works.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: Using "Get Key" with Global Transition
« Reply #7 on: October 18, 2019, 01:40:50 PM »
Hi.
state 1
Make a new fsm for the key, and use get key down.

then do a local transition to state 2

in state to use send event and target the fsm where the global event is :)

AxelG

  • Playmaker Newbie
  • *
  • Posts: 34
Re: Using "Get Key" with Global Transition
« Reply #8 on: October 18, 2019, 05:21:36 PM »
Oh perfect, it worked, thanks. So if I understand well, this kind of event must happen outside of the actual FSM correct?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: Using "Get Key" with Global Transition
« Reply #9 on: October 18, 2019, 07:07:14 PM »
Hi.
It depends on the usage.

But breaking a loop would be easier that way.

AxelG

  • Playmaker Newbie
  • *
  • Posts: 34
Re: Using "Get Key" with Global Transition
« Reply #10 on: October 18, 2019, 11:59:27 PM »
Okay, thanks you both for your help!