How to use the rot-js.VK_NUMPAD9 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
import Ladder from '#/entities/misc/Ladder.js'
import { xp_levels } from '#/entities/Entity.js'
import Gold from '#/entities/items/misc/Gold.js'
import Chest from '#/entities/misc/Chest.js'
import Item from '#/entities/items/Item.js'
import { createItem } from '#/utils/EntityFactory.js'
import { AutoexploreGoal } from '../../utils/Goals'
import MapRevealingScroll from '../items/scrolls/MapRevealingScroll'

const movementKeys = [
	ROT.VK_RIGHT,
	ROT.VK_LEFT,
	ROT.VK_UP,
	ROT.VK_DOWN,
	ROT.VK_NUMPAD8,
	ROT.VK_NUMPAD9,
	ROT.VK_NUMPAD6,
	ROT.VK_NUMPAD3,
	ROT.VK_NUMPAD2,
	ROT.VK_NUMPAD1,
	ROT.VK_NUMPAD4,
	ROT.VK_NUMPAD7,
	ROT.VK_H,
	ROT.VK_U,
	ROT.VK_L,
	ROT.VK_N,
	ROT.VK_J,
	ROT.VK_B,
	ROT.VK_K,
	ROT.VK_Y
]
github seiyria / Roguathia / src / js / rogue / init / debug.js View on Github external
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();
  });
};