export const ATLAS_TILE_WIDTH = 32 export enum Tile { EMPTY, WALL, GHOST_WALL, FOOD, PLAYER_SPAWN_1, PLAYER_SPAWN_2, PLAYER_SPAWN_3, PLAYER_SPAWN_4, GHOST_SPAWN, THICC_DOT, INITIAL_DOT } export enum Wall { EMPTY, WALL_HZ, WALL_VT, TURN_Q1, TURN_Q2, TURN_Q3, TURN_Q4, TEE_NORTH, TEE_EAST, TEE_SOUTH, TEE_WEST, CROSS, DOT, WALL_END_NORTH, WALL_END_SOUTH, WALL_END_EAST, WALL_END_WEST } export enum ItemType { DOT } export enum Key { NOTHING, UP, DOWN, LEFT, RIGHT } export type KeyMap = { [key: string]: Key } export const GameKeyMap = { "KeyW": Key.UP, "KeyA": Key.LEFT, "KeyS": Key.DOWN, "KeyD": Key.RIGHT, } export enum Rotation { NOTHING, NORTH, EAST, SOUTH, WEST } export type Vec2 = { x: number, y: number } export type InputMap = { [key: number]: Key } export type Player = { pos: Vec2, moveRotation: Rotation, inputRotation: Rotation, moving: boolean, name?: string } export type PlayerInput = { start: boolean, key: Key, name?: string } export type Input = { players: {[key: number]: PlayerInput}, added?: number[], removed?: number[], } export type Message = { type?: string; connections?: number[], added?: number, removed?: number, id?: number, frame?: number, data?: any, connection?: number, state?: GameState, error?: string } export type Players = { [key: number]: Player } export type Item = { type: ItemType, pos: Vec2 } export type Items = { [key: number]: Item } export type Map = { data: number[], walls: number[], width: number, height: number, id: number } export type Maps = { [key: number]: Map } export type GameState = { started: boolean, input: InputMap, players: Players, items: Items, mapId: number | undefined } export type Frame = { data: GameState, input: Input }