Skip to main content

Beats of Betrayal Lua API

Describes the Beats of Betrayal Lua interface.

Work in progress.

Entity Module

Creating, modifying, and instructing entities.

e = Entity.spawn("Slime", 79, 29)
e:move(29, 29, 10, { damage = 10 })
e.dead = true

Player.heal()

Also see EntityRef for interaction.

Inventory Module

Interact with the player inventory.

if Inventory.get("BeatCoin"):use(10) then
Inventory.get("Shuriken"):add(5)
end

Background Module

Interact with the background.

Background.id = "stars"
Background.speed = { x = 5.0, y = 3.0 }

Light Module

Configure the global lighting.

Light.ambient = 0.6
Light.bleed = 0.25

Loop Module

Control the music of the game.

Loop.id = "wind"
Loop.volume = 0.5

Theme Module

Visual theme settings affecting many effects.

Theme.color = { r = 0, g = 255, b = 255 }
Theme.spectrum_color = { r = 0, g = 128, b = 255 }

Shader Module

The shader interface.

Shader.clear()
Shader.activate_group("intro_base")

Effect Module

The effect interface.

Effect.reset()

effect = Effect.sight()
effect:stop()
effect:reverse()

Interface Module

The user interface.

Interface.hud = "hidden"
Interface.mbar = false

World Module

Generic global world interface.

World.z = 1

Log Module

The logging interface.

Log.info(":)")
Log.warn(":(")

Time Module

The time interface.

Time.wait(0.7)

Feature Module

The feature interface.

Feature.all = false
Feature.dash = true

Dialog Module

The dialog interface.

Dialog.plain { msg = "Hello, World!" }

Sound Module

The sound interface.

Sound.play { path = "misc/spawn", vol = 0.5 }

bob Module

Old and deprecated scripting functionality.

bob.log(":)")

All of these functions are supposed to be replaced in the future. However, not everything has a replacement yet.