Mode:
Duration:
1
Coding works best on desktop or with an external keyboard.
Coding works best on desktop or with an external keyboard.
A basic Defold script in Lua to move a player left and right using arrow keys.
-- player.script
function init(self)
self.speed = 200
end
function update(self, dt)
local move = vmath.vector3()
if go.get_action("left").pressed then
move.x = move.x - 1
end
if go.get_action("right").pressed then
move.x = move.x + 1
end
go.set_position(go.get_position() + move * self.speed * dt)
endDefold is a free, cross-platform 2D game engine developed by King, designed for rapid development of high-performance 2D games. It features a lightweight editor, Lua scripting, a component-based architecture, and efficient deployment across multiple platforms.
Origin & Creator
Defold was created by King (the company behind Candy Crush) and released as a free engine in 2016, with full source available for developers under a permissive license.
Industrial Note
Defold is particularly popular for mobile 2D games, indie projects, game jams, and studios needing lightweight, maintainable, and efficient game engines.