Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python
import os, sys
from xml.dom import minidom
#--------------------------------------
BASE_PATH = os.path.dirname(__file__)
MAP_SRC_DIR = os.path.join(BASE_PATH, 'data/maps')
MAP_COMPILED_DIR = os.path.join(BASE_PATH, 'data/maps/compiled')
// InfiniteOutsideState.as
package beulah {
import org.flixel.*;
public class InfiniteOutsideState extends FlxState {
private var worldChunks:FlxGroup;
private var worldChunkMap:Object;
private var currentWorld:Object;
package beulah {
import org.flixel.*;
public class Background extends FlxGroup {
private var cloudsOne:FlxSprite;
private var cloudsTwo:FlxSprite;
private var landOne:FlxSprite;
private var landTwo:FlxSprite;
private var screenTestPoint:FlxPoint;
private var season:String;
#pragma strict
#pragma downcast
class SpeakingCharacter extends MonoBehaviour {
// ------------------------------------------
// Properties
// ------------------------------------------
public var characterName : String;
public var conversationXMLFile : TextAsset;
@jakevsrobots
jakevsrobots / cheapmarkovtweets.java
Created February 22, 2012 22:18
Processing sketch that does a fake markov chain type reprocessing of a twitter search feed
void setup() {
// Fetch recent tweets from twitter with a certain keyword
XMLElement xml = new XMLElement(this, "http://search.twitter.com/search.atom?q=lasertag");
XMLElement[] tweets = xml.getChildren("entry/title");
String corpus = "";
for(int i=0; i<tweets.length; i++) {
corpus += tweets[i].getContent();
}
@jakevsrobots
jakevsrobots / flickr_bot.java
Created February 23, 2012 17:17
Processing sketch that fetches stuff from twitter & flickr
ArrayList imageList;
int currentImageIndex = 0;
ArrayList fetchNewImages(String keyword) {
XMLElement xml = new XMLElement(this, "http://api.flickr.com/services/feeds/photos_public.gne?tags=" + keyword + "&amp;lang=en-us&amp;format=rss_200");
XMLElement[] linkTags = xml.getChildren("entry/link");
ArrayList imageList = new ArrayList();
@jakevsrobots
jakevsrobots / GoogleAnalytics.cs
Created May 16, 2012 22:23
A few utilities for triggering google analytics events from within Unity.
using UnityEngine;
public class GoogleAnalytics {
public static string gameIdentifier = "YourGameName";
public static void TrackEvent(string eventName, string eventLabel="") {
string googleAnalyticsCall = "_gaq.push(['_trackEvent', '" + GoogleAnalytics.gameIdentifier + "', '" + eventName + "'";
if(eventLabel != "") {
googleAnalyticsCall += ", '" + eventLabel + "'";
using UnityEngine;
using System.Collections;
public class TitleScreenAnalyticsEvents : MonoBehaviour {
void Start () {
GoogleAnalytics.TrackEvent("start_level", "title_screen");
}
}
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 EventsTest : MonoBehaviour {
void Start () {
EventManager.AddEventListener("test-event", delegate() {
Debug.Log("Test event was triggered!");
});
StartCoroutine(TriggerTestEvent());