Skip to content

Instantly share code, notes, and snippets.

@spotco
spotco / gist:8265971
Created January 5, 2014 08:50
bash convert files to mp3 sox bash
for f in *.m4a; do sox "$f" -C 56 "${f%.m4a}.mp3"; done
@spotco
spotco / gist:8452705
Last active January 3, 2016 10:59
ShooterGame
import java.awt.Color;
import java.awt.event.KeyEvent;
import java.util.*;
public class ShooterGame extends GamePanel {
public static void main(String[] args) {
new ShooterGame(500,500);
}
@spotco
spotco / gist:8586743
Created January 23, 2014 21:03
HTML5 Canvas Orbit Simulator
<!DOCTYPE html>
<html>
<head>
<title>HTML5 Canvas</title>
<script>
function get_canvas_cursor_position(canvas, evt) {
var rect = canvas.getBoundingClientRect();
return {
x: evt.clientX - rect.left,
y: evt.clientY - rect.top
@spotco
spotco / gist:6bf6dbd72097a5f69449
Created May 11, 2014 10:01
Speedypups indiecade
>>>Please provide a brief description of your game that is as specific as possible about the game mechanic, aesthetics, narrative (if applicable) and experience of playing the game. (max. 150 words). This gives an overview of your goals with the game, and who the game’s audience may be. It will guide the assignment of judges to your game, and be those judge’s first impression.
SpeedyPups is an iOS platformer-runner game designed to capture the speed and fluidity of Sonic, with depth and creative level designs not elsewhere seen in the genre. You'll be running, jumping, dashing, breaking stuff, bouncing off robots and doing all sorts of gravity-defying tricks!
And while we're at it, there are multiple different worlds each with their own deviously tricky boss. The robots have captured the baby pups, are you a bad enough mutt to save them all? Don't let the cute graphics and seemingly simple controls fool you - this game's designed to be a fast, fluid action platformer with enough challenge to satisfy even th
@spotco
spotco / gist:80a8be85dbbfbfa8dc9b
Last active August 29, 2015 14:04
working hit detection (3 files)
package {
import flash.geom.Vector3D;
import org.flixel.FlxGroup;
import org.flixel.FlxSprite;
import org.flixel.FlxState;
import org.flixel.FlxG;
import org.flixel.FlxCamera;
import org.flixel.FlxRect;
import org.flixel.system.input.Keyboard;
rtv = ActiveRecord::Base.connection.execute("
(SELECT pending_participant.first_name AS first_name, pending_participant.last_name AS last_name, pending_participant.email AS email, 'Pending' as status
FROM sdo_pending_participants AS pending_participant
WHERE pending_participant.sdo_turnkey_project_id = 2443)
UNION
(SELECT DISTINCT participant.first_name AS first_name, participant.last_name AS last_name, participant_email_address.email_address AS email, participant_project.status as status
FROM participants AS participant
app.preferences.rulerUnits = Units.PIXELS;
var srcDoc = app.activeDocument;
var numOfLayers = srcDoc.layers.length;
var results = "";
for (var i = 0; i < numOfLayers; i++)
{
var theLayer = srcDoc.layers[i];
results += "["+(numOfLayers-i-1)+"]"+theLayer.name+"\n";
}
// Save this file in Program Files\Adobe\Photoshop\Presets\Scripts\
// In PhotoShop CS5, run it by going menu File > SCripts > Browse > layersToSprite.js
if (documents.length > 0) {
// Adjust this to the number of columns you want
//leave -1 if you want it to calculate an optimal column value.
var cols = -1;
var docRef = activeDocument;
@spotco
spotco / ELMVal.cs
Created November 19, 2015 08:20
ELMVal
/*
ELM (Eased Linear Motion) Value
Matches the start-end time of a linear motion curve with constant velocity,
but has motion easing and constant acceleration.
Can set target once, or every update.
*/
public struct ELMVal {
private float _target_vel; //target velocity
private float _t; //time in current curve
{"type":"dialogue","text":"I come back to an empty classroom. Everyone's still out for lunch.","xpos":0,"ypos":0},
{"type":"dialogue","text":"As I head inside, I notice a familiar figure in the back.","xpos":0,"ypos":0},
{"type":"showcharacter","character":"Raichi","image":"char_raichi_normal","xpos":300,"xscale":1},
{"type":"dialogue","text":"It's Raichi. He's alone at his desk reading a book.","xpos":0,"ypos":0},
{"type":"dialogue","text":"He looks up as I walk in.","xpos":0,"ypos":0},
{"type":"showcharacter","character":"Kurumi","image":"char_kurumi_normal","xpos":-300,"xscale":1},
{"type":"dialogue","character":"Raichi","text":"Ah, Kurumi. What brings you back so early?","xpos":22,"ypos":53},