Skip to content

Instantly share code, notes, and snippets.

View MattRix's full-sized avatar

Matt Rix MattRix

View GitHub Profile
using UnityEngine;
using System;
using System.Collections.Generic;
public class DenomMaker
{
public static List<int> GetDenoms(int[] denoms, int totalValue, int numCoins)
{
List<int> resultCoins = new List<int>(numCoins+10);
@MattRix
MattRix / TrainyardTutorials.xml
Last active August 29, 2015 13:57
Trainyard Tutorials XML
<?xml version="1.0" encoding="UTF-8"?>
<tutorials>
<tutorial slug="welcome" name="Welcome!">
<!--welcome and explain goal of the game-->
<step>
<create_box xy="160,260">Welcome to TRAINYARD!</create_box>
<delay time="2" />
<reset_allActions />
<create_box xy="160,300">This tutorial will explain[br]how to solve puzzles</create_box>
@MattRix
MattRix / readme.txt
Created May 15, 2014 23:14 — forked from anonymous/readme.txt
Cake Monsters!
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
@MattRix
MattRix / RXSolutionFixer.cs
Created November 24, 2014 19:39
The advanced version of my RXSolutionFixer, this one upgrades the csproj and removes all unityprojs from the solution
using UnityEngine;
using System.Collections;
using UnityEditor;
using System.IO;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System;
class RXSolutionFixer : AssetPostprocessor
@MattRix
MattRix / Basic.shader
Last active August 29, 2015 14:13
Futile Basic shader rewritten for Unity 5 (no fixed function stuff)
//from http://forum.unity3d.com/threads/68402-Making-a-2D-game-for-iPhone-iPad-and-need-better-performance
Shader "Futile/Basic" //Unlit Transparent Vertex Colored
{
Properties
{
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
}
Category
@MattRix
MattRix / Socket.io with Node.js error
Created May 11, 2011 20:40
Error with Socket.io and Node.js
Initializing client with transport "websocket"
node: ../src/node.cc:1210: ssize_t node::DecodeWrite(char*, size_t, v8::Handle<v8::Value>, node::encoding): Assertion `b[1] == 0' failed.
@MattRix
MattRix / FSpriteOverlap
Created August 16, 2012 02:27
Checking FSprites for overlap with a point
someSprites //your list of sprites you want to check through
Vector2 checkPoint = new Vector2(155,100); //the point you want to check
List<FSprite> overlapSprites = new List<FSprite>(); //a list of sprites that contain the point
foreach(FSprite sprite in someSprites)
{
//"this" should be whatever node you're currently in, or Futile.stage
Vector2 localPoint = sprite.LocalToLocal(this, checkPoint);
@MattRix
MattRix / BitmapHierarchyTester.as
Created August 22, 2012 21:29
A way of using the display tree while still only drawing bitmaps in AS3
package ca.struct
{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
import flash.events.Event;
[SWF (width=500,height=400,backgroundColor=0x000000,frameRate=60)]
public class BitmapHierarchyTester extends Sprite
{
@MattRix
MattRix / CSharpPerformanceTester
Created August 24, 2012 15:18
A tool for comparing the performance of different code in C#. Just call PerfTest.Run();
using System;
using System.Collections.Generic;
using System.Diagnostics;
public class Thing
{
public float a;
public float b;
public float c;
@MattRix
MattRix / Bench.cs
Last active November 12, 2015 15:31
Photobomb painting code
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
public class Bench : MonoBehaviour
{
static public bool SHOULD_DEBUG = true;
static public Color defaultColor = Color.white;