Skip to content

Instantly share code, notes, and snippets.

View Bradshaw's full-sized avatar
๐Ÿš€
Lost in space

Gaeel Bradshaw-Rodriguez Bradshaw

๐Ÿš€
Lost in space
View GitHub Profile
-- Metatable for thing, contains all methods
local thing_mt = {}
-- Namespace for thing-class functions
thing = {}
-- All the things
thing.all = {}
-- Use this function to create a new thing

This jammer doesn't like themes

I don't like themes.

Context

We're talking about "game jams". A game jam is a time-limited event, where the participants create a video game. The goal is to spark creativity, learn more about making games, have fun, and bring the game development community together in a spirit of mutual support and friendship.

Most game jams have a theme, often in the form of a short phrase or a word (sound files, pictures, bits of video and other things are sometimes seen too...)

@Bradshaw
Bradshaw / FuckYouUnityGetYourFuckingActTogether.cs
Created May 20, 2014 13:07
FuckYouUnityGetYourFuckingActTogether.cs
using UnityEngine;
using System.Collections;
public static class FuckYouUnityGetYourFuckingActTogether {
public static float GetAxis(string axisname)
{
switch (axisname)
{
case "Horizontal":
@Bradshaw
Bradshaw / main.lua
Last active September 17, 2019 11:23
Simple fudge for lรถve usage
function love.load(arg)
-- Include Fudge
fudge = require("fudge")
-- Create new texture pack from folder "gfx"
f = fudge.new("gfx")
-- Set the current texture pack (for monkeypatched love.graphics.draw)
fudge.current = f
@Bradshaw
Bradshaw / fudge_monkey_draw.lua
Last active January 22, 2018 20:31
The magic of ellipsis in Lua
local old_draw = love.graphics.draw
local monkey_draw = function(im, ...)
if fudge.current and type(im)=="string" then
--Get associate and draw it
local fud = fudge.current:getPiece(im)
old_draw(fud.img, fud.quad, ...)
elseif type(im)=="table" and im.img and im.quad then
old_draw(im.img, im.quad, ...)
elseif type(im)=="table" and im.batch then
old_draw(im.batch)
@Bradshaw
Bradshaw / ninjaCommentSwitch.js
Created June 19, 2014 09:27
How to do comment-switching on a single line
/*
This switch is used for development, when I want to be able to run the server without the extra services running.
prefilledArray is an array of objects that is a sample of what the extra services return.
*/
// In no-services dev mode
var data = /**[];//**/prefilledArray;
@Bradshaw
Bradshaw / leng.lua
Created June 24, 2014 18:46
Table lengths
t = {42, 43, 44}
print(#t) -- Displays "3" in console
print(#t[2]) -- Error: attempt to get length of a number value
o = {
{11,12},
{21,22,23,24},
{31,32,33}
}
print(#o) -- Displays "3" in console
@Bradshaw
Bradshaw / fudgeset.lua
Created June 28, 2014 11:39
Funky use of tables and calling to do a sort of switch case in lua
function fudge.set(option, value)
if type(option)=="table" then
for k,v in pairs(option) do
fudge.set(k, v)
end
return
end
;({
current = function(v)
fudge.current = v
@Bradshaw
Bradshaw / options.js
Last active August 29, 2015 14:03
Options
function initThingWithOptions(thing, options){
thing.val = ('val' in options) ? options.val : 10 // Again, 10 is my default...
}