This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# replace this line with the root-directory of your android project | |
LOVE_ANDROID=/home/Documents/Programming/ANDROID/love-android-sdl2/ | |
# build a .love file | |
cd src/ | |
zip -r game.love * -x *.git* | |
# move it to the android project, package and deploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Soul:update(dt) | |
local target_x, target_y = self.target_x, self.target_y | |
-- do we already have a target? | |
if (not target_x) and (not target_y) then | |
-- figure out the hook position | |
local hook_angle = math.pi*2/(#self.master.souls)*self.index + love.timer.getTime()*3 | |
target_x = self.master.x + math.cos(hook_angle)*32 | |
target_y = self.master.y + math.sin(hook_angle)*32 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
useful.canvasStack = {} | |
function useful.pushCanvas(newCanvas) | |
table.insert(useful.canvasStack, love.graphics.getCanvas()) | |
love.graphics.push() | |
love.graphics.origin() | |
love.graphics.setCanvas(newCanvas) | |
end | |
function useful.popCanvas() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local __unsafeUpdate = function() | |
local dt = math.min(MAX_DT, love.timer.getDelta()) | |
-- do your update here | |
end | |
function love.update() | |
local success, err = xpcall(__unsafeUpdate, debug.traceback) -- use debug.debug for interactive debugging | |
if not success then | |
print(err) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[------------------------------------------------------------ | |
IMPORTS | |
--]]------------------------------------------------------------ | |
local Animation = require("unrequited/Animation") | |
--[[------------------------------------------------------------ | |
ALL RESOURCES | |
--]]------------------------------------------------------------ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Singleton : Monobehaviour | |
{ | |
private static Singleton _instance = null; | |
public static Singleton instance | |
{ | |
get | |
{ | |
if (_instance == null) | |
{ | |
// First try to find an instance already in the scene |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class AbstractSkeletonTrackingDevice : AbstractControlDevice | |
{ | |
// ... | |
protected void registerExerciseInput(SkeletonExercise new_exercise) | |
{ | |
// ... | |
foreach(string axis_name in new_exercise.axisNames) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- O shape | |
local tetro_O = "**--".. | |
"**--".. | |
"----".. | |
"----" | |
-- J shape | |
local tetro_J1 = "-*--".. | |
"-*--".. | |
"**--".. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Sacrifice:matchTetros(tetros, col, row) | |
for _, t in ipairs(tetros) do | |
local i = 1 | |
local matches = {} | |
for c = col, col + 3 do | |
for r = row, row + 3 do | |
local char = t:sub(i,i) | |
local limb, core = (char == '*'), (char == '@') | |
if (limb or core) then | |
if self:match(c, r) then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
What if you want to pick a random option but you're not sure if that random option will be valid? | |
Instead of doing a while loop and hoping that you'll eventually land on a valid option | |
try shuffling the list of options and trying each one in this random order ;) | |
W. | |
--]] | |
local shuffle = function(table) -- standard Fisher-Yates implementation | |
for i = #table, 2, -1 do |
OlderNewer