Skip to content

Instantly share code, notes, and snippets.

View metamethod.lua
local table = {}
local mp = {
__newindex = function(table, key, value)
if key == "a" then
error("NO YOU DON'T")
end
end,
}
setmetatable(table, mp)
View experimenting with moving background.lua
local yOffset = 0
local xOffset = 0
local xDirection = -1
local yDirection = -1
local width, height = 32, 32
local speed = 80
love.window.setMode(800, 600, {resizable = true})
love.graphics.setDefaultFilter("nearest", "nearest")
love.draw = function()
@Vovkiv
Vovkiv / Moving background maybe.lua
Last active Aug 8, 2021
Moving background in love
View Moving background maybe.lua
local yOffset = 0
local xOffset = 0
local xDirection = -1
local yDirection = -1
local width, height = 32, 32
love.window.setMode(800, 600, {resizable = true})
love.draw = function()
local windowWidth = love.graphics.getWidth()
local windowHeight = love.graphics.getHeight()
View animation with framerate.lua
animation = {[1] = love.graphics.newCanvas(100, 100), [2] = love.graphics.newCanvas(100, 100)}
frame = 1
frameRate = 10
curFrameTime = 0
love.graphics.setCanvas(animation[1])
love.graphics.circle("line", 50, 50, 50, 50)
love.graphics.rectangle("line", 20, 20, 20, 20)
love.graphics.setCanvas()
View fullScreenCycle.lua
local fullscreenCycle =
{
_VERSION = 1000,
_URL = "https://gist.github.com/Vovkiv/f234b4c9263d4642f87d48ce8db37be8",
_INTERPRETER = {
love = 11.3,
},
_DESCRIPTION = "Can switch in-beetwen window mode easly, return window state in Love2d",
_LICENSE = "None",
_NAME = "Fullscreen Cycle",
View game_minimap.txt
https://www.reddit.com/r/gamedev/comments/oxuz24/a_year_ago_i_wrote_an_article_on_my_minimap/
Last year, I wrote an article about the design process behind Scrabdackle's minimap. That format served the demo well, but I knew it could be improved, and I wanted to take things from good to great for the full game. I'm going to take last year's starting point and run through how and why I chose to change formats per the gif above.
There's some non-design reasoning behind this, as well - the new format is much more scalable and maintainable, and also allows me to drastically improve background loading and manage cross-map events - but I'll stick purely to discussing the design here unless anyone asks otherwise.
Design rules
Let me start by restating the design rules I've been working with, which are unchanged from a year ago:
You should not be able to play the game or explore the world by looking at the minimap
View AspectScaling.lua
local aspect =
{
_VERSION = 1000,
_URL = "https://gist.github.com/Vovkiv/f234b4c9263d4642f87d48ce8db37be8",
_INTERPRETER = {
love = 11.3,
},
_DESCRIPTION = "Can handle best fit scaling for games with specific resolution in Love2d",
_LICENSE = "None",
_NAME = "Aspect Scaling",