Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "src/modules/game/common/projection"

Index

Variables

Functions

Variables

Const SCALE

SCALE: 8 = 8

Number of vertical pixels per grid unit.

Functions

get2dCoordsFromIso

  • get2dCoordsFromIso(x: number, y: number, z: number): [number, number]
  • Converts a 3D grid location to a 2D isometric screen projection.

    Parameters

    • x: number

      The X grid coordinate in 3D space.

    • y: number

      The Y grid coordinate in 3D space.

    • z: number

      The Z grid coordinate in 3D space.

    Returns [number, number]

    • An [X, Y] array of the 2D screen coordinates.

getZIndex

  • getZIndex(x: number, y: number, z: number): number
  • Gets the Z-index of a grid location.

    Note: This is used to draw sprites and graphics to the screen in the correct order (back to front, bottom to top).

    Parameters

    • x: number

      The X grid coordinate in 3D space.

    • y: number

      The Y grid coordinate in 3D space.

    • z: number

      The Z grid coordinate in 3D space.

    Returns number

    • The Z-index of the input grid coordinates.

Generated using TypeDoc