Skip to content

Instantly share code, notes, and snippets.

class Foo
{
public function new() {}
}
@triplefox
triplefox / gist:2899990
Created June 9, 2012 07:34
list of gamedev (and related) ircs
irc.freenode.net
<p>
<a href="http://vidyadev.com/wiki">#vidyadev</a> <br>
<a href="http://www.reddit.com/r/gamedev">#reddit-gamedev</a> <br>
<a href="http://hashbbg.com/">#bbg</a> <br>
<a href="http://www.polycount.com/forum/">#model_design</a> <br>
<a href="http://www.glorioustrainwrecks.com/">#glorioustrainwrecks</a> <br>
<a href="http://opengameart.org/">opengameart</a> <br>
<a href="http://moosader.com/">Moosader</a> <br>
<a href="http://elysianshadows.com/project/">#elysian_shadows</a> <br>
@triplefox
triplefox / gist:2900005
Created June 9, 2012 07:40
list of gamedev (and related) ircs
@triplefox
triplefox / gist:2936511
Created June 15, 2012 13:36
in-progress autotiler
public inline function rewriteAutoTiling(p : { x:Int, y:Int }, fallback : Int)
{
// collect the indices for the tile positions.
var idx_tl = result.c21(p.x * 2, p.y * 2);
var idx_tr = tl + 1;
var idx_bl = result.c21(p.x * 2, p.y * 2 + 1);
var idx_br = bl + 1;
@triplefox
triplefox / AlphaTrie.hx
Created September 23, 2012 01:08
AlphaTrie
class AlphaTrie
{
// an implementation of a trie specifically for storing and looking up english dictionary words
public var chars : Hash<AlphaTrie>;
public var ending : Bool;
public function new()
{
package com.ludamix.heart;
/**
* Tilemap which turns abstract metatiles into groups of four subtiles via
* an algorithm that checks a collision mask.
*/
class AutoTilemap<T : (AutoTileDef)> implements Tilemap<TypedGrid<T>>
{
public var width (getWidth, null) : Int;
package com.ludamix.entity;
class Entity
{
public var id(default, null) : Int;
public var properties : Dynamic;
public function new(id, properties)
{
@triplefox
triplefox / mech.py
Created October 17, 2014 04:53
example of staticmethod
import random
class Mech(object):
def __str__(self):
return "Name: %s\n\tweight: %s\n\tslots: %s\n\tmax heat: %s" % (self.name, self.max_weight, self.slots, self.max_heat)
@staticmethod
def generator():
obj = Mech()
obj.name = 'Random Mech '+str(random.randint(0,9999))
obj.weight = random.randint(1,10)
package com.ludamix.ds;
class Deli
{
public static function parse(s : String) {
var m = new Map<String, Array<String>>();
for (l /*line*/ in s.split("\n")) {
var i0 = l.indexOf("["); var i1 = l.indexOf("]");
var k /*key*/ = l.substr(0, i0); var d /*delimiter*/ = l.substr(i0 + 1, i1 - i0 - 1); var v /*value*/ = l.substr(i1 + 1);
var r /*value results*/ : Array<String>; /*get result array*/ if (m.exists(k)) r = m.get(k); else { r = new Array(); m.set(k, r); }
package com.ludamix.ds;
class Deli
{
public static function parse(s : String) {
var m = new Map<String, Array<Array<String>>>();
for (l /*line*/ in s.split("\n")) {
var i0 = l.indexOf("["); var i1 = l.indexOf("]");
var k /*key*/ = l.substr(0, i0);
var d /*delimiter*/ = l.substr(i0 + 1, i1 - i0 - 1);