Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing on Game Development and University

Brandon Blanker Lim-it flamendless

🎯
Focusing on Game Development and University
View GitHub Profile
View mana.lua
local classic = require("modules.classic.classic")
local guiMana = classic:extend()
function guiMana:new()
self.max = 100
self.current = 100
self.percent = 1
self.x = game.gWidth/2 + 8
self.y = game.gHeight - 3
@flamendless
flamendless / Love2D-wiki-trimmer.lua
Created Mar 10, 2018
Love2D api/wiki trimmer (removes non-english .html files). Also useful for other batch deletion using lua and lfs.
View Love2D-wiki-trimmer.lua
--LOVE2D api/wiki trimmer
--Also useful for other batch deletion using lua and lfs
--Created by Brandon Blanker Lim-it @flamendless
local lfs = require("lfs")
local toRemove = {
"_deutsch",
"_portugu",
"_fran",
@flamendless
flamendless / String-to-secret-code.lua
Created Mar 13, 2018
Convert string into secret code!
View String-to-secret-code.lua
--Secret Code Parser - change strings into secret codes defined!
--Created by Brandon Blanker Lim-it @flamendless
local str_sample = arg[1] or "Hi, my name is Brandon"
--this is the JEJEMON trend code
local secret_code = {
a = {"4","ha","ah"},
i = "1",
e = "3",
o = "0",
View color.lua
local Colors = {
RESET = {1,1,1,1},
WHITE = {1,1,1},
BLACK = {0,0,0},
RED = {1,0,0},
GREEN = {0,1,0},
BLUE = {0,0,1},
}
local setup_args = function(args, tween)
View palette-swap.lua
local Pswap = {}
local orig_pal
local new_pal
local image
local image2
local lookup = {}
function Pswap:load()
local orig_pal_data = love.image.newImageData("orig.png")
View Noise.lua
-- Create 256 shuffled numbers
local perm = {}
for i = 1, 256 do
table.insert(perm, math.random(#perm + 1), i)
end
-- Repeat the list
for i = 1, 256 do
perm[i+256] = perm[i]
end
@flamendless
flamendless / noise-to-image.lua
Created Jul 10, 2018
Save a noise to a texture! thanks Positive07
View noise-to-image.lua
local data = love.image.newImageData(w, h)
data:mapPixel(function(x,y,r,g,b,a)
local a = love.math.noise(x, y)
return a, a, a, 1
end)
if isSaveIt then
data:encode("png", filename or "noise.png")
local image = love.graphics.newImage(data)
return image
else
@flamendless
flamendless / CircleTransformation.lua
Last active Sep 28, 2018
Interpolate a circle to another circle (number of points/2)
View CircleTransformation.lua
local processPoints = function(shape1, shape2)
local d = #shape1/#shape2 * 2
local all = {}
for i = 1, #shape1, 2 do
all[i] = false
if i % d == 1 then
all[i] = true
end
end
return all
@flamendless
flamendless / convert-to-grayscale.lua
Created Oct 16, 2018
Convert a palette .png (num of colours x 1 pixel) to appropriate grayscaled palette (for colour swap shader)
View convert-to-grayscale.lua
function love.load()
for k, file in pairs(love.filesystem.getDirectoryItems("source")) do
convert(file)
end
end
function convert(file)
local data = love.image.newImageData("source/" .. file)
local width = data:getWidth()
local div = 255/width
@flamendless
flamendless / MakefileLoveAndroid
Last active Nov 8, 2018
Makefile for easier love development for android using apktool
View MakefileLoveAndroid
--usage: make build-android
--usage: make apk-release VERSION=0.1.3
--note: You must still edit the versionCode in AndroidManifest.xml
SHELL := /bin/zsh
ANDROID = PATH:/opt/android-sdk/build-tools/28.0.2
LOVE_NAME = game.love
BUILD_DIR = build
OUTPUT_DIR = ${BUILD_DIR}/output
RELEASE_DIR = ${BUILD_DIR}/release
NAME = purrr