LoveDialogue is a simple and flexible dialogue system for LÖVE (Love2D) games.
- Easy-to-use dialogue system
- Fade in/out animations for dialogue boxes
- Custom scripting language for dialogue files
examplevid.mp4
- Copy the
LoveDialogue.lua
andLoveDialogueParser.lua
files into your LÖVE project directory. - Require the module in your
main.lua
file:
local LoveDialogue = require "LoveDialogue"
- Create a dialogue file with the
.ld
extension (e.g.,dialogue.ld
). - In your
main.lua
, load and start the dialogue:
function love.load()
myDialogue = LoveDialogue.play("dialogue.ld")
end
function love.update(dt)
if myDialogue then
myDialogue:update(dt)
end
end
function love.draw()
if myDialogue then
myDialogue:draw()
end
end
function love.keypressed(key)
if (key == "space" or key == "return") and myDialogue then
myDialogue:advance()
end
end
Dialogue files use a simple syntax:
Character: Dialogue text goes here.
AnotherCharacter: More dialogue text.
You can customize the appearance of the dialogue box by modifying the properties in the LoveDialogue:new()
function.
For a better editing experience and syntax highlighting, I recommend using the "Love2D Dialog (.ld) Language Support" extension for Visual Studio Code. I made this extension specifically for this library. This extension provides syntax highlighting for .ld files.
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.