Object
CollisionInfo
Collision info gotten by Object.get_collision_info
Properties
collides : boolean
semisolid : boolean
Object
Object placed within the map. Object is a little unique compared to other types because of the two ways to use it. Using its functions (i.e. Object.get_collision_info) will act upon the calling object. However, it can also be gotten via the collision callback, and from there, the methods can be used. These are not mutually exclusive; you cannot call i.e. get_collision_info on an Object obtained via the collision callback, and vice versa.
Properties
position : Vec2
Two component Vector
size : Vec2
Two component Vector
name : string
Functions
get_collision_info(x : number, y : number)
Get information about the Object’s collision the current tile
get_prop_bool(key : string)
->boolean
Get a custom property from the Object (bool)
get_prop_color(key : string)
->Color
Get a custom property from the Object (Color)
get_prop_float(key : number)
->boolean
Get a custom property from the Object (float)
get_prop_int(key : integer)
->boolean
Get a custom property from the Object (int)
get_prop_string(key : string)
->string
Get a custom property from the Object (string)
set_map(path : string)
->string
Change the current map.
get(self, name : string)
->boolean | string | number | nil
Get a global variable defined within the Object’s scope.
Type Limitations
This works, obviously, because each Object has its own Lua state where its variables are stored. But a very unfortunate limitation of Lua is that complex types such as tables and userdatas (most important because this is the underlying type for every engine type, i.e. Vec2s and Textures) cannot be passed between two Lua states.
This limits this to only the following primitives: boolean, integer, number, string, or nil.
set(self, name : string, value : boolean | string | number | nil)
->boolean | string | number | nil
Set a global variable defined within the Object’s scope. If the variable is undefined, a new one will be set within that object.
Type Limitations
This works, obviously, because each Object has its own Lua state where its variables are stored. But a very unfortunate limitation of Lua is that complex types such as tables and userdatas (most important because this is the underlying type for every engine type, i.e. Vec2s and Textures) cannot be passed between two Lua states.
This limits this to only the following primitives: boolean, integer, number, string, or nil.