Skip to content

LightWorld

Matías Hermosilla edited this page Aug 4, 2017 · 11 revisions

The 'LightWorld' Object

Importing

local LightWorld = require("shadows.LightWorld")

Functions

LightWorld World = LightWorld:new()
Description: Creates a light world.

local newLightWorld = LightWorld:new()

Methods

LightWorld:Draw()
Description: Draws the light world

LightWorld:Update()
Description: Updates the world.

LightWorld:InitFromPhysics(World World)
Description: Adds all the bodies from a physics world to a scenario once (not over time).

LightWorld:SetColor(number R, number G, number B)
Description: Changes the ambient color of the world.

LightWorld:SetPosition(number x, number y, number z)
Description: Sets the position of the camera on the light world, the 'Z' parameter is for scaling.

number x, number y, number z = LightWorld:GetPosition()
Description: Gets the actual position of the camera on the light world.

number R, number G, number B = LightWorld:GetColor()
Description: Gets the ambient color of the world.

LightWorld:Resize(number Width, number Height)
Description: Resizes the light world to fit a custom window size.

LightWorld:ForceUpdate()
Description: Forces the world to update the shadows.

Callbacks

LightWorld:DrawShadows(Light Light)
Description: Called when the lights require to draw the custom shadow shapes on their canvas (i.e the shadow of a player).

LightWorld:DrawSprites(Light Light)
Description: Called when the lights require to draw the custom images to cover shadows (i.e. the body of a player covering his shadow).

Clone this wiki locally