Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/james2doyle/love2d-template

A LÖVE (Love2d) template that includes what you may need to develop a game with modern niceties
https://github.com/james2doyle/love2d-template

love2d lua

Last synced: 13 days ago
JSON representation

A LÖVE (Love2d) template that includes what you may need to develop a game with modern niceties

Awesome Lists containing this project

README

        

Love2D Template
===============

> A LÖVE (Love2d) template that includes everything you need to develop a game with modern niceties

### Why?

Mostly just exploring Love2d and some modules. Also trying to wrap my head around how I should structure a game and all it's parts.

### Install

```sh
git clone https://github.com/james2doyle/love2d-template
cd love2d-template
love .
```

### Running

The game starts with a splash page, then goes to the main menu. You can click some of the menu items to go to those other menus. Pressing any button in the credits goes back to the main menu.

Pressing `\`` at any time will toggle the debug menu.

### Modules

* [Badr](https://github.com/Nabeel20/Badr) - Simple and easy user interfaces with composable components
* [Roomy](https://github.com/tesselode/roomy) - Organize your game into "screens" (title/start screen, levels, pause screen)
* [Flux (fork)](https://github.com/Sheepolution/flux) - Fast, lightweight tweening library
* [Step](https://github.com/Sheepolution/step) - Timer module for interval actions or delayed actions
* [Lurker (fork)](https://github.com/jeduden/lurker) - Auto-swaps changed files in a running
* [Lume (fork)](https://github.com/NQMVD/lume) - Helpful functions
* [Luacolors](https://github.com/icrawler/luacolors) - Collection of functions for common colors and conversions

## Snippets

#### A new "scene"

```lua
local _sceneName = {}

-- `previous` - the previously active scene, or `false` if there was no previously active scene
-- `...` - additional arguments passed to `manager.enter` or `manager.push`
function _sceneName:enter(previous, ...)
-- set up the level
end

function _sceneName:update(dt)
-- update entities
end

function _sceneName:keypressed(key)
-- someone pressed a key
end

function _sceneName:mousepressed(x, y, button, istouch, presses)
-- someone clicked the mouse
end

-- `next` - the scene that will be active next
-- `...` - additional arguments passed to `manager.enter` or `manager.pop`
function _sceneName:leave(next, ...)
-- destroy entities and cleanup resources
end

-- `next` - the scene that was pushed on top of this scene
-- `...` - additional arguments passed to `manager.push`
function _sceneName:pause(next, ...)
-- destroy entities and cleanup resources
end

-- `previous` - the scene that was popped
-- `...` - additional arguments passed to `manager.pop`
function _sceneName:resume(previous, ...)
-- Called when a scene is popped and this scene becomes active again.
end

function _sceneName:draw()
-- draw the level
end

return _sceneName
```