Skip to content

Instantly share code, notes, and snippets.

@jakevsrobots
jakevsrobots / browsergames.md
Created November 5, 2012 20:22
Notes for "browser games" class @ WebArt
@jakevsrobots
jakevsrobots / centipede.js
Created November 5, 2012 20:18
Centipede-style game in Javascript with Canvas
// Setup canvas
var canvas = document.createElement("canvas");
canvas.width = 640;
canvas.height = 320;
document.body.appendChild(canvas);
var context = canvas.getContext("2d");
// Setup keyboard
var keyboard = {
left: 37,
@jakevsrobots
jakevsrobots / control_raw_data.py
Created October 15, 2012 00:04
Play back raw data from a file, using pitch tracking from microphone input as an index.
""" Control playback of raw data using pitch tracking from input. """
import pyaudio
import wave
import analyse
import numpy
import sys
import random
p = pyaudio.PyAudio()
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
public class ClosureTest : MonoBehaviour {
void Start () {
List<int> sourceData = new List<int>();
for(int i=0; i < 10; i++) {
sourceData.Add(i);
@jakevsrobots
jakevsrobots / ClosureTest.cs
Created July 11, 2012 22:52
yield/delegate/loop closure issue
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
public class ClosureTest : MonoBehaviour {
void Start () {
List<int> sourceData = new List<int>();
for(int i=0; i < 10; i++) {
sourceData.Add(i);
using UnityEngine;
using System.Collections;
public class AppUpInitialize : MonoBehaviour {
bool connected = false;
void Awake () {
DontDestroyOnLoad(gameObject);
if(!connected) {
using UnityEngine;
using System;
using System.Runtime.InteropServices;
public class AppUp {
public static bool isTesting = true;
[DllImport ("baKno")]
public static extern int ConnectToIntelADP(uint l1, uint l2, uint l3, uint l4, string bkid);
[DllImport ("baKno")]
using UnityEngine;
using System.Collections;
public class EventsTest : MonoBehaviour {
void Start () {
EventManager.AddEventListener("test-event", delegate() {
Debug.Log("Test event was triggered!");
});
StartCoroutine(TriggerTestEvent());
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class PlaytimeTracker : MonoBehaviour {
public int heartbeatCount = 0;
void Awake() {
DontDestroyOnLoad(gameObject);
}
using UnityEngine;
using System.Collections;
public class TitleScreenAnalyticsEvents : MonoBehaviour {
void Start () {
GoogleAnalytics.TrackEvent("start_level", "title_screen");
}
}