Skip to content

Instantly share code, notes, and snippets.

View 01010111's full-sized avatar
πŸ‘½
πŸ•Ή

Will Blanton 01010111

πŸ‘½
πŸ•Ή
View GitHub Profile
@01010111
01010111 / ECS.hx
Last active July 16, 2019 16:24
Simple Entity Component System for Haxe
class ECS
{
static var ENTITIES:Map<String, Int> = new Map();
static var COMPONENTS:Map<String, Map<Int, Dynamic>> = new Map();
static var SYSTEMS:Map<ISystem, Array<String>> = new Map();
static var ID_NUMERATOR:Int = 0;
public static function register_entity(name:String)
{
@01010111
01010111 / Vec4.hx
Last active July 12, 2019 21:06
Vector class
using Math;
abstract Vec4(Array<Float>)
{
// Utility
static var epsilon:Float = 1e-8;
static function zero(n:Float):Float return n.abs() <= epsilon ? 0 : n;
public static function run_tests() Vec4Tests.run();
@01010111
01010111 / Timer.hx
Created October 2, 2019 22:54
Basic Timer class for Haxe
class Timer {
static var timers:Array<Timer> = [];
static var pool:Array<Timer> = [];
static var epsilon:Float = 1e-8;
public static function get(time:Float, fn:Void -> Void, repeat:Int = 1):Timer {
var timer = pool.length > 0 ? pool.shift() : new Timer();
timer.time = time;
timer.fn = fn;
@01010111
01010111 / AStar.hx
Last active October 22, 2019 14:29
A* Algo with simplifications!
import zero.utilities.IntPoint;
using Math;
class AStar {
public static function get_path(map:Array<Array<Int>>, options:AStarOptions):Array<IntPoint> {
// Set defaults
if (options.mode == null) options.mode = CARDINAL_ONLY;
@01010111
01010111 / HitBox.hx
Last active November 12, 2019 15:39
Get Hitboxes from 2D Array
import zero.utilities.IntPoint;
import zero.utilities.Rect;
class HitBox {
static function main() {
for (rect in make_hitboxes([
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
@01010111
01010111 / 0 - README.md
Last active November 20, 2019 15:07
OGMO Editor 3 Flixel integration using zerolib-flixel

Integrating OGMO Editor 3 in HaxeFlixel

Using OGMO files in HaxeFlixel is quick and easy! By using typedefs and haxe.Json.parse() you can load your level's data with very little hassle.

This example uses my zerolib-flixel library, but all the code for what you need is listed below - just make sure you update the references if you use these files instead of using zerolib-flixel!

@01010111
01010111 / FlxEcho.hx
Last active April 29, 2021 17:25
Quick Flixel <-> Echo integration
package util;
import echo.data.Options.BodyOptions;
import flixel.FlxBasic;
import flixel.FlxObject;
import flixel.FlxObject.*;
import flixel.group.FlxGroup;
import echo.Echo;
import echo.World;
import echo.Body;
@01010111
01010111 / PlayState.hx
Created December 13, 2019 14:30
Scrollable Text Area
package states;
import flixel.FlxG;
import flixel.FlxState;
import flixel.math.FlxRect;
import flixel.text.FlxText;
using Math;
class PlayState extends FlxState {
@01010111
01010111 / SimplePlayer.hx
Created January 21, 2020 16:19
Simplest Flixel Player
import flixel.FlxG;
import flixel.FlxObject;
import flixel.FlxSprite;
class Player extends FlxSprite {
var WALK_SPEED = 200;
var JUMP_POWER = 300;
var FRAME_WIDTH = 16;
var FRAME_HEIGHT = 16;
@01010111
01010111 / Tween.hx
Last active February 6, 2020 19:36
Simple Dimple Tweening in Haxe
package util;
using Math;
using zero.extensions.FloatExt;
class Tween {
static var active_tweens:Array<Tween> = [];
static var pool:Array<Tween> = [];