Luawe the Wayfarer Engine's scripting language All pages

A thing

An object, a piece of floor, a text or a group. Besides what is listed here, every number its rows show in the editor can be read and set by its id: thing.alpha, thing.color.r, thing.blur.amount, thing.particles.rate.

thing.name

The thing's name.

thing.kind

"object", "floor", "text" or "group".

thing.type

An object's type: "block", "saw", "spike" or "deco" (for the others, the same as kind).

thing.exists

Is the thing still there? (False once it was destroyed, or its time was up.)

thing.x

Where its left edge is, in tiles, as its row in the editor shows it (a text: where it is anchored). Set it to move the thing. Its middle is thing.centerX.

thing.y

Where its top edge is, in tiles (down is more). Its middle is thing.centerY.

thing.width

How wide it is, in tiles (the same as thing.w).

thing.height

How tall it is, in tiles (the same as thing.h).

thing.rotation

How far it is turned, in degrees.

thing.alpha

How solid it looks: 1 fully, 0 not at all.

thing.visible

Does it show? Set it to false and the thing sinks away and can't be touched; to true and it pops back.

thing.text

A text's words. Set it to change what the text says.

thing.touching

Is the cube touching it right now?

thing.touched

An event that happens when the cube starts to touch it.

thing.untouched

An event that happens when the cube stops touching it.

thing.centerX

Where its middle really is right now, from left to right: with its keys, its group and whatever moves it.

thing.centerY

Where its middle really is right now, from top to bottom.

thing:tween

thing:tween(properties, seconds?, ease?, direction?)

Glides its numbers to new values: door:tween({y = 4}, 1). The same as tween(thing, ...).

thing:clone

thing:clone()

A copy of the thing, made now: a thing of its own, with the same name.

thing:destroy

thing:destroy()

The thing goes, for the rest of the run.

thing:get

thing:get(property)

One of its numbers by its id, as a level file has it: thing:get("blur.amount").

thing:set

thing:set(property, value)

Sets one of its numbers by its id: thing:set("color.r", 255).

thing:addChild

thing:addChild(kind, properties?)

Puts a child on it: "follow", "lookat", "blur", "opacity", "proximity", "nohitbox", "gradient", "particles" or "image". properties: the child's numbers, as in {amount = 0.5}.

thing:removeChild

thing:removeChild(kind)

Takes a child of that kind off it.

thing:hasChild

thing:hasChild(kind)

Does it have a child of that kind?