Skip to content

Instantly share code, notes, and snippets.

named_scope :sort_string, lambda do |type|
order_string = case type
when 'score'
"score desc"
when 'date'
"created_at desc"
else
raise "Unknown type passed into sort_string: #{type.inspect}"
end
// the node OOP-way
function Awake () {
var networkConnector = NetworkConnector(isHost());
networkConnector.connect(function() {
spawnPlayer();
});
}
// the unity3d-ish way
@mikelovesrobots
mikelovesrobots / jasmine_pretty_print_monkeypatch.coffee
Created July 24, 2012 18:53
Jasmine pretty print monkeypatch for sane test failure messages (dump in spec/javascripts/helpers)
jasmine.PrettyPrinter.prototype.iterateObject = (obj, fn) ->
for own property, _ of obj
if property == '__Jasmine_been_here_before__'
continue
fn(property, if obj.__lookupGetter__ then (obj.__lookupGetter__(property) != jasmine.undefined && obj.__lookupGetter__(property) != null) else false)
jasmine.StringPrettyPrinter::originalEmitObject = jasmine.StringPrettyPrinter::emitObject
jasmine.StringPrettyPrinter::emitObject = (obj) ->
if obj instanceof jQuery

Piggyback Dungeon Ryder is a coop dungeon crawler about an archer that rides on the back of a giant. Player one controls the giant, and player two controls Ryder with the crossbow. Throughout the game, the two players will have to cooperate to overcome the challenges contained in the procedurally-organized dungeon. Traps and monsters await. They'll fight, they'll die and perhaps learn to love one another as a man loves a giant and a giant loves a man.

The story will be told through brief conversations between the two on rare enemy-free levels. Ryder is cursed and can't touch the ground or he'll die, and the giant needs to prove his bravery to be allowed to mate back home. They're on a quest together to break the curse. I'm hoping for a bit of a roadtrip feel, but we'll see how that turns out in days to come.

I'm working on the game by myself, and so far I'm pretty happy with my progress. Today was spent mostly on getting the giant's animations in place, building scenery textures, and working on

@mikelovesrobots
mikelovesrobots / gist:5811851
Created June 19, 2013 05:23
Just because Apple/Objective-C wants you to put everything in one goddamn file doesn't mean you actually have to have it all in one file.
//
// MapViewController.m
// placesihavepooped
//
// Created by Michael Judge on 6/16/13.
// Copyright (c) 2013 Michael Judge. All rights reserved.
//
#import "MapViewController.h"
@mikelovesrobots
mikelovesrobots / unlit-transparent-flash-fx.shader
Created January 25, 2014 05:24
Unlit/transparent shader that can flash the textures white (pure black is all original texture, white is all white)
Shader "Unlit/TransparentFlashFX" {
Properties {
_Color ("Color Tint", Color) = (1,1,1,1)
_MainTex ("SelfIllum Color (RGB) Alpha (A)", 2D) = "white"
}
Category {
Lighting On
ZWrite Off
Cull Back
Blend SrcAlpha OneMinusSrcAlpha
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
public class DudeDeathController : MonoBehaviour {
...
public void Die() {
DudeMotionArrester.SlowToStop();
Animator.Play("DudeDie");
@mikelovesrobots
mikelovesrobots / AccelerometerAdapter.cs
Last active August 29, 2015 13:57
Adapter for Unity that uses the mouse for input if the current device (e.g., the editor) doesn't support acceleration. MIT license, so go nuts.
using UnityEngine;
using System.Collections;
public class AccelerometerAdapter : MonoBehaviour {
public const float TILT_SENSITIVITY = 1.5f;
public Vector3 Input {
get {
if (SystemInfo.supportsAccelerometer) {
return UnityEngine.Input.acceleration * TILT_SENSITIVITY;
@mikelovesrobots
mikelovesrobots / Character.cs
Created March 28, 2014 00:13
Dungeon Highway Character Model
using UnityEngine;
using System.Collections;
[System.Serializable]
public class Character {
public CharacterType CharacterType;
public Sprite DefaultSprite;
public string PortraitSpriteName;
public string WalkAnimationName {
@mikelovesrobots
mikelovesrobots / gist:e526809506a17b4db65b
Created March 3, 2015 21:15
Bulk Material Creator for Unity3d. Just select your textures, then select from the menu Assets > Bulk Material Creator, assign a shader and hit create. MIT License.
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
public class BulkMaterialCreator : ScriptableWizard
{
public Shader Shader;