Skip to content

Instantly share code, notes, and snippets.

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

Will Blanton 01010111

πŸ‘½
πŸ•Ή
View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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 / 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 / Vec2.hx
Last active July 10, 2019 21:45
Vector class
using Math;
abstract Vec2(Array<Float>)
{
public static var UP (default, never):Vec2 = [0, -1];
public static var DOWN (default, never):Vec2 = [0, 1];
public static var LEFT (default, never):Vec2 = [-1, 0];
public static var RIGHT (default, never):Vec2 = [1, 0];
@01010111
01010111 / OgmoExample.hx
Created June 11, 2019 16:05
Example of using OgmoUtils class
using OgmoUtils;
class OgmoExample
{
public function new(level_json:String)
{
var data = level_json.parse_level_json();
var tile_layer = data.get_tile_layer('tiles');
trace(tile_layer.data2D);
@01010111
01010111 / OgmoUtils.hx
Last active May 15, 2022 02:46
Utility class for Ogmo
using haxe.Json;
class OgmoUtils
{
// region PARSING
/**
* Parse OGMO Editor level .json text
* @param json
* @return LevelData