How to use the rot-js.VK_NUMPAD7 function in rot-js

To help you get started, we’ve selected a few rot-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Larkenx / Rotten-Soup / src / assets / js / game / entities / actors / Player.js View on Github external
})
		this.keyMap = {
			// Arrow Pad
			[ROT.VK_RIGHT]: 2,
			[ROT.VK_LEFT]: 6,
			[ROT.VK_UP]: 0,
			[ROT.VK_DOWN]: 4,
			// Numpad Movement
			[ROT.VK_NUMPAD8]: 0,
			[ROT.VK_NUMPAD9]: 1,
			[ROT.VK_NUMPAD6]: 2,
			[ROT.VK_NUMPAD3]: 3,
			[ROT.VK_NUMPAD2]: 4,
			[ROT.VK_NUMPAD1]: 5,
			[ROT.VK_NUMPAD4]: 6,
			[ROT.VK_NUMPAD7]: 7,
			// vi movement
			[ROT.VK_H]: 6,
			[ROT.VK_U]: 1,
			[ROT.VK_L]: 2,
			[ROT.VK_N]: 3,
			[ROT.VK_J]: 4,
			[ROT.VK_B]: 5,
			[ROT.VK_K]: 0,
			[ROT.VK_Y]: 7,
			// Rest using '5' in numpad
			[ROT.VK_NUMPAD5]: 'rest',
			// Fire a weapon
			[ROT.VK_F]: 'fire',
			// Cast a spell
			[ROT.VK_Z]: 'cast',
			// Interact
github seiyria / Roguathia / src / js / rogue / init / debug.js View on Github external
document.body.addEventListener('keydown', (e) => {

    const offsets = {
      [ROT.VK_W]: { x: 0, y: -1 },
      [ROT.VK_S]: { x: 0, y: 1 },
      [ROT.VK_A]: { x: -1, y: 0 },
      [ROT.VK_D]: { x: 1, y: 0 },

      [ROT.VK_NUMPAD8]: { x: 0, y: -1 },
      [ROT.VK_NUMPAD2]: { x: 0, y: 1 },
      [ROT.VK_NUMPAD4]: { x: -1, y: 0 },
      [ROT.VK_NUMPAD6]: { x: 1, y: 0 },

      [ROT.VK_NUMPAD7]: { x: -1, y: -1 },
      [ROT.VK_NUMPAD3]: { x: 1, y: 1 },
      [ROT.VK_NUMPAD1]: { x: -1, y: 1 },
      [ROT.VK_NUMPAD9]: { x: 1, y: -1 }
    };

    if(!offsets[e.keyCode] || !GameState.manualMove) return;

    const player = GameState.players[0];
    player.moveTo(player.x+offsets[e.keyCode].x, player.y+offsets[e.keyCode].y);
    GameState.game.engine.unlock();
  });
};