Skip to content

Instantly share code, notes, and snippets.

#define DEBUG_CONSOLE
#define DEBUG_LEVEL_LOG
#define DEBUG_LEVEL_WARN
#define DEBUG_LEVEL_ERROR
#if (UNITY_EDITOR || DEVELOPMENT_BUILD)
#define DEBUG
#endif
#if (UNITY_IOS || UNITY_ANDROID)
@poemdexter
poemdexter / Lissajou.cs
Created December 9, 2013 05:20
Pistol sway based on Lissajou curve.
using UnityEngine;
using System.Collections;
// gun sway based on lissajou curve
// formula found in example 3 of http://www.intmath.com/trigonometric-graphs/7-lissajous-figures.php
public class Lissajou : MonoBehaviour
{
float local_X;
float local_Y;
float t = 0;
if (GlobalParams.IsWorldGenComplete()) {
// spawn player
Vector2 pos = GetComponent<WorldGenerator>().getPlayerSpawnPosition();
Instantiate(playerPrefab, new Vector3(pos.x, playerPrefab.transform.position.y, pos.y), playerPrefab.transform.rotation);
GlobalParams.MarkPlayerSpawned();
} else {
Debug.LogError("[SpawnPlayer.SpawnNewPlayer] worldgen not complete and trying to instantiate new player.");
}
@poemdexter
poemdexter / VectorLand.java
Created December 1, 2013 20:14
Internet Janitor's VectorLand client
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.awt.geom.*;
import javax.swing.*;
import java.io.*;
import java.net.*;
public class VectorLand {
static final Image buff = new BufferedImage(640, 480, BufferedImage.TYPE_INT_ARGB);
@poemdexter
poemdexter / unity_movement.txt
Last active December 29, 2015 08:29
Quick explanation of unity movement via transform manipulation.
code in question:
transform.position += transform.right * Input.GetAxis(axisName) * speed * Time.DeltaTime;
transform.position
position vector of the entity this script is attached to
transform.right
vector representing "right" relative to this entity's rotation. normally is <1,0,0>. for example,
you have no rotation and are facing forward. your "right" would be <1,0,0>. if you turn 180
degrees, your "right" would be <-1,0,0>.
@poemdexter
poemdexter / bestquery2.sql
Created November 9, 2013 01:53
bestquery just got bester!
select
i.*,
p.file
from
items i,
photos p
on
i.id = p.id (+)
and p.sort = 1 (+);
@poemdexter
poemdexter / bestquery.sql
Created November 9, 2013 01:48
select all from items and first file from photos based on ID
select
i.*,
p.file
from
items i
left join
photos p
on
i.id = p.id
and sort = 1;
@poemdexter
poemdexter / equality
Created November 5, 2013 19:55
equality for realz
if (a == b && a === b && a ==== b && a.equals(b)) {
print("totes equal for realz");
}
@poemdexter
poemdexter / .screenrc
Created November 1, 2013 15:01
do the cool screen thing that david welborn showed me.
# Supress screen's startup message
startup_message off
# Define a bigger scrollback, default is 100 lines
defscrollback 10000
# An alternative hardstatus to display a bar at the bottom listing
# the windownames and highlighting the current windowname in blue.
hardstatus alwayslastline "%{.bW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H%{..Y} %m/%d %C%a "
ISR 2.0's Entry Window Is Closing, Ever So Slowly.
It's past noon on September 15th, and that means that Indie Speed Run 2013's entry window is officially closer to closing than it is to ... uh ... opening.
Basically, you have two weeks left.
If you haven't participated yet, get to it. And if you have participated already, then stop being lazy and participate a second (or third) time. Did you know there is an insane game developer out there working on his fourth entry? That's right, you're not as productive as an insane person. So, crunch on that for awhile, slacker.
Regardless of whether or not you've already Run or are planning on Running soon, we've noticed a few things of which, we believe, it's worth reminding you:
1. You can submit more than one game with the same team, by yourself, or with a new team.