Skip to content

Module: ammo

Michael Ebens edited this page Jun 22, 2018 · 3 revisions

ammo is the main module which manages, mainly there to manage the current world. The table itself and ammo.path are defined in init.lua, while the rest of its functionality is defined in core/init.lua. If core/init.lua is imported directly, without init.lua, it will define ammo and ammo.path itself.

Properties

default This is the world that ammo.world will default to if it is set to nil. This is by default a blank world created via World:new(). If you set this to nil, Ammo will set it to a new blank world.

ext
A table with which extensions can indicate they are loaded. For example, ammo-physics would set ammo.ext.physics to true.

path
The package path specifying where Ammo is located, relative to your game's path. This is used internally to load the other files in the library.

world
The currently active game world, which must be an instance of World. If this is set to nil, it will default to ammo.default. When you set this, the world (and thus the actual value of ammo.world) isn't actually changed until the next frame.

Methods

draw()
Calls the current world's draw callback. If you haven't already defined love.draw, Ammo will set it to this function (as in, love.draw = ammo.draw). If you do need to define a custom love.draw, remember to call ammo.draw inside it.

update(dt)
Updates the value of ammo.world, if needed, and calls the current world's update callback. The same information from ammo.draw applies to this function, except it's with love.update.

dt: The delta time.

Clone this wiki locally