Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/guilleatm/love2d-utils

Useful libraries for making games with love2d
https://github.com/guilleatm/love2d-utils

game-development gamedev love2d love2d-framework love2d-library

Last synced: about 2 months ago
JSON representation

Useful libraries for making games with love2d

Awesome Lists containing this project

README

        

# Using the repo
Clone repo (and submodules): git clone --recurse-submodules https://github.com/guilleatm/love2d-utils.git
Update repo (and submodules): git submodule update --remote
Push repo (and submodules): git add, commit and push for each submodule, then for the project
> Use: git submodules foreach 'git command' for executing the same command in each submodule

# Useful code for making games with Löve2D

[Löve2D web](https://love2d.org/wiki/Main_Page)

## Animations

Download Animation.lua for making this work (and the .png)

```lua
-- main.lua

require 'Animation'

function love.load()
love.graphics.setDefaultFilter("nearest", "nearest") -- Not necessary, it is for loading correctly pixelart images.

local img = love.graphics.newImage("oldHero.png") -- Sprite size --> 16 x 18
myAnimation = Animation:new(img, 16, 18, 0.5, true) -- The animation takes 0.5 seconds and loops until myAnimation:stop()
myAnimation:setScale(8) -- The drawn image is 8 times bigger than the real size.
myAnimation:addCallback(5, function() print("I am called in the frame 5!!") end) -- Each time the animation reaches the 5 frame, this function is called.
myAnimation:start() -- Starts the animation.
end

function love.update(dt)
myAnimation:update(dt) -- Remember the update and the draw!!
end

function love.draw()
myAnimation:draw(200, 200) -- Remember the update and the draw!!
end
```

## Tilemaps

Create your own tilemaps with this library!!

## Utils

Useful functions for your games (a bit random)

## Camera

Simple and useful camera (not mine)

## Pathfinding (A*)

[Pathfinding Algorithm A*](https://github.com/lattejed/a-star-lua) (not mine)