A downloadable project

🎬 Scene Manager

A simple scene manager for LÖVE2D

Version: 0.1.1

✨ Features

  • Simple scene switching
  • load(), update() and draw() support
  • YOU'LL NEED LÖVE2D of course 🕹️

🚀 Usage

🛠️ 1. Add SceneManager to your project

Download the release file, unzip it and copy SceneManager.lua file into your LÖVE2D project.

Your project should looks something like this:

project/
  |--- main.lua
  |--- SceneManager.lua

📦 2. Include the library

Add this to your main.lua

SceneManager = require("Path.To.SceneManager")

Replace Path.To.SceneManager with the path where you put SceneManager.lua.

For example if SceneManager.lua is inside a libraries folder:

SceneManager = require("libraries.SceneManager")

Use . to separate folders in the path 📁

🖼️ 3. Create a Scene

Create a new Lua file for your scene.

For example create World.lua:

local world = {}
function world:load()
end
function world:update(dt)
end
function world:draw()
end
return world

Yuo can use these functions just like how you use love.load, love.update, and love.draw, but remember to use self. as prefix for your variables.

Then in your main.lua, include your scene:

World = require("World")

🎮 4. How to use your Scene

To switch between scene use:

SceneManager:switch(Scene)

Replace Scene with your included scene.

💡 Note: You can also use this in your scene file too

In the main.lua file, you'll need to switch to your default scene on startup, by using the switch function inside love.load():

function love.load()
    SceneManager:switch(World)
end

Here I set the default scene to World.

And to make the draw and update working, add this to your main.lua:

function love.draw()
    SceneManager:draw()
end
function love.update(dt)
    SceneManager:update(dt)
end

With this, SceneManager will executing the draw and update function from current scene.

📝 Changelogs

This project follows Semantic-versioning (MAJOR.MINOR.PATCH)

v0.1.0 - First Release

  • Simple scene switching
  • load(), update() and draw() support

v0.1.1 - It's Just a README 📄

  • Just some updates on the README.md file

💬 Leave a Comment!

Don't forget to leave a comment down below! 👇 I would love to hear your feedback, suggestions, or reviews to help improve this library. Let me know if you run into any bugs 🐛 or have ideas for new features! 💡

🌐 Visit My itch.io!

🔗 AstrotCosmixDev.itch.io

StatusReleased
CategoryOther
Release date 67 days ago
AuthorAstrotCosmixDev
Made withLÖVE
Tagslibrary, LÖVE, scene
Code licenseMIT License
ContentNo generative AI was used

Download

Download
SceneManager-v0.1.0.zip 2.6 kB
Download
SceneManager-v0.1.1.zip 3.1 kB

Development log

Leave a comment

Log in with itch.io to leave a comment.