Global functions (PGE-Lua)

From PGE Wiki
Jump to: navigation, search

Text functions

Text Functions
Function Return values Description
Renderer.printText(string text, int x, int y) nil Prints text at x, y with specific font-type 0 of white color
Renderer.printText(string text, int x, int y, int fontType, int size) nil Prints text at x, y with specific font-type with size 14 pt if TTF font was used (font-type -1) of white color
Renderer.printText(string text, int x, int y, int fontType, int size, int rgba) nil Prints text at x, y with specific font-type with specific size if TTF font was used (font-type -1) of white color
Renderer.printText(string text, int x, int y, int fontType, int size, int rgba) nil Prints text at x, y with specific font-type with specific size if TTF font was used (font-type -1) with RGBA-color (32-bit integer which contains defined colors via bitwise way). White would be 0xFFFFFFFF, Semi-transparent green 0x00FF0099

Engine settings

PGE Engine settings
Function Return values Description
Settings.isFullscreenActive() bool Is engine currently in full screen mode
Settings.getScreenWidth() int Returns width of screen
Settings.getScreenHeight() int Returns height of screen
Settings.getTicksPerSecond() int Returns current game speed in Ticks per second
Settings.useFrameSkip() bool Is frame skip enabled
Settings.getSoundVolume() int Current sound effects volume from 0 to 128
Settings.getMusicVolume() int Current music volume from 0 to 128
Settings.isDebugInfoShown() bool Is printing of debug info enabled
Settings.setDebugInfoShown(bool enable) nil Toggles printing of debug info

Logger functions

PGE Engine logger Functions
Function Return values Description
Logger.debug(string) nil Writes message into engine log file with DEBUG tag
Logger.warning(string) nil Writes message into engine log file with WARNING tag
Logger.critical(string) nil Writes message into engine log file with CRITICAL tag

Effects (Built-in Animations) functions

Effects functions
Function Return values Description
Effect.runStaticEffect(int effectID, float x, float y) nil Spawns a simple static effect at specific coordinates on the level relative to left-top corner of effect sprite
Effect.runStaticEffectCentered(int effectID, float x, float y) nil Spawns a simple static effect at specific coordinates on the level relative to center of effect sprite

Audio functions

Audio functions
Function Return values Description
Audio.playSound(int soundID) nil Plays sound effect of specific sound ID
Audio.playSoundByRole(int soundID) nil Plays sound of specific sound role


Static item Functions

Static Player functions

Static Player Functions (Overworld and level)
Function Return values Description
Player.count() number How many playable characters are in the level.
Player.get() table of Player Returns all playable characters in the level.

Static NPC functions (Level only)

Static NPC Functions
Function Return values Description
NPC.count() number How many NPCs are in the level.
NPC.get() table of NPCBase Returns all NPCs
NPC.getActive() table of NPCBase Returns all NPCs