InputMapper taking over?

Code first:

class AppState1 extends BaseAppState{
// Bind a key to the 'up' lemur navigation
        inputMapper.map(F_Y_AXIS, MOVEUP_K);
}

class AppState2 extends BaseAppState{
// Bind the same key with the 'up' ingame funcion
        inputMapper.map(F_MOVE, BigBananaAppState.MOVEUP_K);
}

If I attach AppState1, and then AppState2:
the ingame F_MOVE don’t work.

I probably misunderstood something but don’t know what… thanks

Your functions F_Y_AXIS and F_MOVE have a groups, right?
So you need something that does inputMapper.activateGroup or deactivateGroup according to the context.

Yes and they are both activated. The issue is about “overlapping mappings” (more specifically, the receiver of the event).

I tought that either:

  • both mappings works
  • the most recent mapping work but the old mapping don’t

But in practice only the old mapping works. So… is this by design?

EDIT: got it. I must “deactivateGroup” for the old mapping, otherwise the new one won’t work.
But is it really by design?

1 Like

It maybe a bug. If you map something to space and then later map something else to space… I think you should expect either the second one to override it or throw an exception. And it’s probably better to just let it override.