Skip to content

Instantly share code, notes, and snippets.

@MCarlomagno
Created October 10, 2020 12:03
Show Gist options
  • Save MCarlomagno/31efbf17c398d24b230c6ac27221bf76 to your computer and use it in GitHub Desktop.
Save MCarlomagno/31efbf17c398d24b230c6ac27221bf76 to your computer and use it in GitHub Desktop.
var dispatchAction = function (action) {
var pressed = {},
self = this,
f1 = mk.game.fighters[0],
f2 = mk.game.fighters[1];
// where pressed is a map of type <keyboard_code, boolean>
pressed[keyCode] = true;
var move = self._getMove(pressed, mk.controllers.keys.p1, 0);
self._moveFighter(f1, move);
move = self._getMove(pressed, mk.controllers.keys.p2, 1);
self._moveFighter(f2, move);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment