Skip to content
nskaggs edited this page Feb 15, 2024 · 5 revisions

luven.addNormalLight( x, y, color, power, [ lightShape ], [ angle ], [ sx ], [ sy ] ) :

  • Description
    • Add a normal light to the engine.
  • Params
    • x : NUMBER
    • y : NUMBER
    • color : COLOR : { r, g, b }
    • power : NUMBER : Positive (light size multiplier, value between 0 and 1 recommended)
    • lightShape : LIGHTSHAPE
      • By default luven.lightShapes.round
    • angle : NUMBER
      • 0 by default (value in radians)
    • sx : NUMBER
    • sy : NUMBER
      • scale x and y for the light (watch out to adapt the power !)
  • Return
    • lightId : NUMBER
      • Important ID to keep in a variable to be able to use others light functions.

luven.addFlickeringLight( x, y, colorRange, powerRange, speedRange, [ lightShape ], [ angle ], [ sx ], [ sy ] ) :

  • Description
    • Add a flickering light to the engine.
  • Params
    • x : NUMBER
    • y : NUMBER
    • colorRange : COLOR RANGE : { min = { r, g, b }, max = { r, g, b } }
      • A color range for the random system.
    • powerRange : NUMBER RANGE : { min = n, max = n }
      • A power range for the random system. (light size multiplier, value between 0 and 1 recommended)
    • speedRange : NUMBER RANGE : { min = n, max = n }
      • A speed range for the random system. (in seconds)
    • lightShape : LIGHTSHAPE
      • By default luven.lightShapes.round
    • angle : NUMBER
      • 0 by default (value in radians)
    • sx : NUMBER
    • sy : NUMBER
      • scale x and y for the light (watch out to adapt the power !)
  • Return
    • lightId : NUMBER
      • Important ID to keep in a variable to be able to use others light functions.

luven.addFlashingLight( x, y, color, maxPower, speed, [ lightShape ], [ angle ], [ sx ], [ sy ] ) :

  • Description
    • Add a flashing light to the engine, these lights are "OneShot" so this function does not return a lightId.
  • Params
    • x : NUMBER
    • y : NUMBER
    • maxPower : NUMBER : Positive (light size multiplier, value between 0 and 1 recommended)
    • speed : NUMBER : Positive (in seconds)
    • lightShape : LIGHTSHAPE
      • By default luven.lightShapes.round
    • angle : NUMBER
      • 0 by default (value in radians)
    • sx : NUMBER
    • sy : NUMBER
      • scale x and y for the light (watch out to adapt the power !)

luven.removeLight( lightId ) :

  • Description
    • When you don't need a light anymore call this function to allow the engine to recycle the light.
  • Params
    • lightId : NUMBER

luven.setLightPower( lightId, power ) :

  • Description
    • Change the power of a light. (light size multiplier, value between 0 and 1 recommended)
  • Params
    • lightId : NUMBER
    • power : NUMBER

luven.setLightPowerRange( lightId, powerRange ) :

  • Description
    • Change the power range of a light.
  • Params
    • lightId : NUMBER
    • power range : NUMBER RANGE

luven.setLightColor( lightId, color ) :

  • Description
    • Change the color of a light.
  • Params
    • lightId : NUMBER
    • color : COLOR : { r, g, b }

luven.setLightColorRange( lightId, colorRange ) :

  • Description
    • Change the color range of a light.
  • Params
    • lightId : NUMBER
    • colorRange : COLOR RANGE

luven.setLightPosition( lightId, x, y ) :

  • Description
    • Change the position of a light.
  • Params
    • lightId : NUMBER
    • x : NUMBER
    • y : NUMBER

luven.setLightRotation( lightId, dr ) :

  • Description
    • Set the rotation angle
  • Params
    • lightId : NUMBER
    • dr : NUMBER
      • Value in radians

luven.setLightSpeedRange( lightId, speedRange ) :

  • Description
    • Change the speed range of a light.
  • Params
    • lightId : NUMBER
    • speedRange : NUMBER RANGE

luven.setLightScale( lightId, [ sx ], [ sy ] ) :

  • Description
    • Set the scale of the light
  • Params
    • lightId : NUMBER
    • sx : NUMBER
      • 1 by default
    • sy : NUMBER
      • sx by default

luven.moveLight( lightId, dx, dy ) :

  • Description
    • Move a light relatively.
  • Params
    • lightId : NUMBER
    • dx : NUMBER
      • Move amount on the x axis.
    • dy : NUMBER
      • Move amount on the y axis.

luven.getLightPosition( lightId ) :

  • Description
    • Return the position of a light.
  • Params
    • lightId : NUMBER
  • Return
    • x, y : NUMBER
      • Example : local x, y = Luven.getLightPosition(lightId)

luven.getLightPower( lightId ) :

  • Description
    • Return the current power of a light.
  • Params
    • lightId : NUMBER
  • Return
    • power : NUMBER

luven.getLightPowerRange( lightId ) :

  • Description
    • Return the current power range of a light.
  • Params
    • lightId : NUMBER
  • Return
    • power range : NUMBER RANGE

luven.getLightColor( lightId ) :

  • Description
    • Return the current color of a light.
  • Params
    • lightId : NUMBER
  • Return
    • color : COLOR : { r, g, b }

luven.getLightColorRange( lightId ) :

  • Description
    • Return the current color range of a light.
  • Params
    • lightId : NUMBER
  • Return
    • color range : COLOR RANGE

luven.getLightRotation( lightId ) :

  • Description
    • Return the current rotation of a light.
  • Params
    • lightId : NUMBER
  • Return
    • angle : NUMBER : radians

luven.getLightSpeedRange( lightId ) :

  • Description
    • Return the current speed range of a light.
  • Params
    • lightId : NUMBER
  • Return
    • speed range : NUMBER RANGE

luven.getLightScale( lightId ) :

  • Description
    • Return the current scale of a light.
  • Params
    • lightId : NUMBER
  • Return
    • sx, sy : NUMBER

Clone this wiki locally