Settings

LittleJS Engine Settings

  • All settings for the engine are here

Members

(static) cameraPos :Vector2

Position of camera in world space

Type:
Default Value
  • Vector2()

(static) cameraScale :Number

Scale of camera in world space

Type:
  • Number
Default Value
  • 32

(static) canvasFixedSize :Vector2

Fixed size of the canvas, if enabled canvas size never changes

  • you may also need to set mainCanvasSize if using screen space coords in startup
Type:
Default Value
  • Vector2()

(static) canvasMaxSize :Vector2

The max size of the canvas, centered if window is larger

Type:
Default Value
  • Vector2(1920,1080)

(static) canvasPixelated :Boolean

Use nearest neighbor scaling algorithm for canvas for more pixelated look

Type:
  • Boolean
Default Value
  • true

(static) enablePhysicsSolver :Boolean

Enable physics solver for collisions between objects

Type:
  • Boolean
Default Value
  • true

(static) fontDefault :String

Default font used for text rendering

Type:
  • String
Default Value
  • arial

(static) gamepadDirectionEmulateStick :Boolean

If true, the dpad input is also routed to the left analog stick (for better accessability)

Type:
  • Boolean
Default Value
  • true

(static) gamepadsEnable :Boolean

Should gamepads be allowed

Type:
  • Boolean
Default Value
  • true

(static) glEnable :Boolean

Enable webgl rendering, webgl can be disabled and removed from build (with some features disabled)

Type:
  • Boolean
Default Value
  • true

(static) glOverlay :Boolean

Fixes slow rendering in some browsers by not compositing the WebGL canvas

Type:
  • Boolean
Default Value
  • true

(static) gravity :Number

How much gravity to apply to objects along the Y axis, negative is down

Type:
  • Number

(static) headlessMode :Boolean

Disables all rendering, audio, and input for servers

Type:
  • Boolean

(static) inputWASDEmulateDirection :Boolean

If true the WASD keys are also routed to the direction keys (for better accessability)

Type:
  • Boolean
Default Value
  • true

(static) medalDisplayIconSize :Number

Size of icon in medal display

Type:
  • Number
Default Value
  • 50

(static) medalDisplaySize :Vector2

Size of medal display

Type:
Default Value
  • Vector2(640,80)

(static) medalDisplaySlideTime :Number

How quickly to slide on/off medals in seconds

Type:
  • Number
Default Value
  • 0.5

(static) medalDisplayTime :Number

How long to show medals for in seconds

Type:
  • Number
Default Value
  • 5

(static) medalsPreventUnlock :Boolean

Set to stop medals from being unlockable (like if cheats are enabled)

Type:
  • Boolean

(static) objectDefaultAngleDamping :Number

How much to slow angular velocity each frame (0-1)

Type:
  • Number
Default Value
  • 1

(static) objectDefaultDamping :Number

How much to slow velocity by each frame (0-1)

Type:
  • Number
Default Value
  • 1

(static) objectDefaultElasticity :Number

How much to bounce when a collision occurs (0-1)

Type:
  • Number

(static) objectDefaultFriction :Number

How much to slow when touching (0-1)

Type:
  • Number
Default Value
  • 0.8

(static) objectDefaultMass :Number

Default object mass for collision calcuations (how heavy objects are)

Type:
  • Number
Default Value
  • 1

(static) objectMaxSpeed :Number

Clamp max speed to avoid fast objects missing collisions

Type:
  • Number
Default Value
  • 1

(static) particleEmitRateScale :Number

Scales emit rate of particles, useful for low graphics mode (0 disables particle emitters)

Type:
  • Number
Default Value
  • 1

(static) showSplashScreen :Boolean

Enable to show the LittleJS splash screen be shown on startup

Type:
  • Boolean

(static) soundDefaultRange :Number

Default range where sound no longer plays

Type:
  • Number
Default Value
  • 40

(static) soundDefaultTaper :Number

Default range percent to start tapering off sound (0-1)

Type:
  • Number
Default Value
  • 0.7

(static) soundEnable :Boolean

All audio code can be disabled and removed from build

Type:
  • Boolean
Default Value
  • true

(static) soundVolume :Number

Volume scale to apply to all sound, music and speech

Type:
  • Number
Default Value
  • 0.3

(static) tileFixBleedScale :Number

How many pixels smaller to draw tiles to prevent bleeding from neighbors

Type:
  • Number

(static) tileSizeDefault :Vector2

Default size of tiles in pixels

Type:
Default Value
  • Vector2(16,16)

(static) tilesPixelated :Boolean

Disables texture filtering for crisper pixel art

Type:
  • Boolean
Default Value
  • true

(static) touchGamepadAlpha :Number

Transparency of touch gamepad overlay

Type:
  • Number
Default Value
  • 0.3

(static) touchGamepadAnalog :Boolean

True if touch gamepad should be analog stick or false to use if 8 way dpad

Type:
  • Boolean
Default Value
  • true

(static) touchGamepadEnable :Boolean

True if touch gamepad should appear on mobile devices

  • Supports left analog stick, 4 face buttons and start button (button 9)
  • Must be set by end of gameInit to be activated
Type:
  • Boolean

(static) touchGamepadSize :Number

Size of virtual gamepad for touch devices in pixels

Type:
  • Number
Default Value
  • 99

(static) touchInputEnable :Boolean

True if touch input is enabled for mobile devices

  • Touch events will be routed to mouse events
Type:
  • Boolean
Default Value
  • true

(static) vibrateEnable :Boolean

Allow vibration hardware if it exists

Type:
  • Boolean
Default Value
  • true

Methods

(static) setCameraPos(pos)

Set position of camera in world space

Parameters:
NameTypeDescription
posVector2

(static) setCameraScale(scale)

Set scale of camera in world space

Parameters:
NameTypeDescription
scaleNumber

(static) setCanvasFixedSize(size)

Set fixed size of the canvas

Parameters:
NameTypeDescription
sizeVector2

(static) setCanvasMaxSize(size)

Set max size of the canvas

Parameters:
NameTypeDescription
sizeVector2

(static) setCanvasPixelated(pixelated)

Use nearest neighbor scaling algorithm for canvas for more pixelated look

Parameters:
NameTypeDescription
pixelatedBoolean

(static) setEnablePhysicsSolver(enable)

Set if collisions between objects are enabled

Parameters:
NameTypeDescription
enableBoolean

(static) setFontDefault(font)

Set default font used for text rendering

Parameters:
NameTypeDescription
fontString

(static) setGamepadDirectionEmulateStick(enable)

Set if the dpad input is also routed to the left analog stick

Parameters:
NameTypeDescription
enableBoolean

(static) setGamepadsEnable(enable)

Set if gamepads are enabled

Parameters:
NameTypeDescription
enableBoolean

(static) setGlEnable(enable)

Set if webgl rendering is enabled

Parameters:
NameTypeDescription
enableBoolean

(static) setGlOverlay(overlay)

Set to not composite the WebGL canvas

Parameters:
NameTypeDescription
overlayBoolean

(static) setGravity(newGravity)

Set how much gravity to apply to objects along the Y axis

Parameters:
NameTypeDescription
newGravityNumber

(static) setHeadlessMode(headless)

Set to disalbe rendering, audio, and input for servers

Parameters:
NameTypeDescription
headlessBoolean

(static) setInputWASDEmulateDirection(enable)

Set if true the WASD keys are also routed to the direction keys

Parameters:
NameTypeDescription
enableBoolean

(static) setMedalDisplayIconSize(size)

Set size of icon in medal display

Parameters:
NameTypeDescription
sizeNumber

(static) setMedalDisplaySize(size)

Set size of medal display

Parameters:
NameTypeDescription
sizeVector2

(static) setMedalDisplaySlideTime(time)

Set how quickly to slide on/off medals in seconds

Parameters:
NameTypeDescription
timeNumber

(static) setMedalDisplayTime(time)

Set how long to show medals for in seconds

Parameters:
NameTypeDescription
timeNumber

(static) setMedalsPreventUnlock(preventUnlock)

Set to stop medals from being unlockable

Parameters:
NameTypeDescription
preventUnlockBoolean

(static) setObjectDefaultAngleDamping(damp)

Set how much to slow angular velocity each frame

Parameters:
NameTypeDescription
dampNumber

(static) setObjectDefaultDamping(damp)

Set how much to slow velocity by each frame

Parameters:
NameTypeDescription
dampNumber

(static) setObjectDefaultElasticity(elasticity)

Set how much to bounce when a collision occur

Parameters:
NameTypeDescription
elasticityNumber

(static) setObjectDefaultFriction(friction)

Set how much to slow when touching

Parameters:
NameTypeDescription
frictionNumber

(static) setObjectDefaultMass(mass)

Set default object mass for collison calcuations

Parameters:
NameTypeDescription
massNumber

(static) setObjectMaxSpeed(speed)

Set max speed to avoid fast objects missing collisions

Parameters:
NameTypeDescription
speedNumber

(static) setParticleEmitRateScale(scale)

Set to scales emit rate of particles

Parameters:
NameTypeDescription
scaleNumber

(static) setShowSplashScreen(show)

Set if the LittleJS splash screen be shown on startup

Parameters:
NameTypeDescription
showBoolean

(static) setSoundDefaultRange(range)

Set default range where sound no longer plays

Parameters:
NameTypeDescription
rangeNumber

(static) setSoundDefaultTaper(taper)

Set default range percent to start tapering off sound

Parameters:
NameTypeDescription
taperNumber

(static) setSoundEnable(enable)

Set to disable all audio code

Parameters:
NameTypeDescription
enableBoolean

(static) setSoundVolume(volume)

Set volume scale to apply to all sound, music and speech

Parameters:
NameTypeDescription
volumeNumber

(static) setTileFixBleedScale(scale)

Set to prevent tile bleeding from neighbors in pixels

Parameters:
NameTypeDescription
scaleNumber

(static) setTileSizeDefault(size)

Set default size of tiles in pixels

Parameters:
NameTypeDescription
sizeVector2

(static) setTilesPixelated(pixelated)

Disables texture filtering for crisper pixel art

Parameters:
NameTypeDescription
pixelatedBoolean

(static) setTouchGamepadAlpha(alpha)

Set transparency of touch gamepad overlay

Parameters:
NameTypeDescription
alphaNumber

(static) setTouchGamepadAnalog(analog)

Set if touch gamepad should be analog stick or 8 way dpad

Parameters:
NameTypeDescription
analogBoolean

(static) setTouchGamepadEnable(enable)

Set if touch gamepad should appear on mobile devices

Parameters:
NameTypeDescription
enableBoolean

(static) setTouchGamepadSize(size)

Set size of virutal gamepad for touch devices in pixels

Parameters:
NameTypeDescription
sizeNumber

(static) setTouchInputEnable(enable)

Set if touch input is allowed

Parameters:
NameTypeDescription
enableBoolean

(static) setVibrateEnable(enable)

Set to allow vibration hardware if it exists

Parameters:
NameTypeDescription
enableBoolean