LookOut.lua

From PGE Wiki
Jump to: navigation, search

Download lookOut.lua

A small API that will let you pan in the level and look around what is outside the camera.

Installation

Place the file lookOut.lua in either your level's custom graphics folder for use in a level, along with a lunadll.lua file, or in the same directory as your .wld file along with a lunaworld.lua file for use throughout an entire episode.

How to Use

To enable the lookOut.lua, add this line to lunadll.lua:

local lookOut= API.load("lookOut");

This will load the API.

Examples

local lookOut = API.load("lookOut")
local inputs2 = API.load("inputs2")

function onTick()
  if inputs2.state[1].up == inputs2.PRESS then
    lookOut.activate()
  end
end


Documentation

Values

Value Default Description
speed 5 The speed the of the camera when it is moving.
useCursor true Should the cursor be used to move the camera?
useArrows true Sould the arrow keys be used to move the camera?
endCursor true Should making a click with the cursor end the animation?
endPause true Should pressing the 'pause' key end the animation?
border 50 The number of pixels the cursor be at the edge to move the camera when useCursor is true.
endAnimation true Should there be an ending animation when the animation ends.
draw true Should the default arrows be drawn?

Functions

Function Description
activate(x,y) To activate the animation. Has optional x and y parameters. The animation will start at the x-scene and y-scene coordinates, otherwise it will use the player's camera.
deactivate() Will end the animation. If endAnimation is true, then an ending animation will start.
isActivated() Will return a bool defining if the animation is currently activated. This does not account for the ending animation.
isEnding() Will return a bool defining if the end animation is currently activated. This does not account for the normal animation.