Path (class)

From PGE Wiki
Jump to: navigation, search

This class provides fields/functions for managing path objects on the overworld.

Static functions

Static Path Functions
Function Return values Description
Path.count() number How many path objects are on the overworld.
Path.get() table of Path Returns all path objects on the overworld.
Path.get(number or table ids) table of Path Returns all path objects with the matching item ids.
Path.getIntersecting(number x1, number y1, number x2, number y2) table of Path Returns all path objects which are intersecting with an area from x1/y1 to x2/y2.

Instance functions

These fields and functions are part of Path Objects and have to be called for that object. Trying to call them from the static Path class will result in an error. Example (feel free to copy it into your lua file to see how it works):

function onStart()
    for index,myPath in ipairs(Path.get()) do
        myPath.id = 1
    end
end


Path class
Type Function/Field Return values/Value type Description
Field Path.id double The id of the path object.
Field Path.x double The x position of the path object.
Field Path.y double The y position of the path object.
Field Path.width double The width of the path object.
Field Path.height double The height of the path object.
Field Path.visible boolean Whether the object is visible or not. (LunaLua ≥ v0.7.3.2)
Field Path.isValid boolean Whether the object is valid or not.