Skip to content

Instantly share code, notes, and snippets.

@oscarcs
oscarcs / sort.hx
Last active August 29, 2015 14:07
Depthsorting funtimes
private function getSort()
{
var sortval:Float = 0;
var curAngle = loop(((FlxG.camera.angle-90) * Math.PI) / 180);
var r = Math.sqrt(Math.pow(top.getGraphicMidpoint().x - player.x, 2) + Math.pow(top.getGraphicMidpoint().y - player.y, 2));
var phi = Math.atan2(top.getGraphicMidpoint().x - player.x, top.getGraphicMidpoint().y - player.y) + Math.PI;
var topAngle = curAngle;
var botAngle = loop(curAngle + Math.PI);
@oscarcs
oscarcs / ishiharatest.hx
Last active August 29, 2015 14:06
Testing color blind functions with HaxeFlixel / OpenFL and nxColor
var ishihara = new FlxSprite(0, 0, "assets/ishihara2.png");
for (x in 0...Std.int(ishihara.width))
{
for (y in 0...Std.int(ishihara.height))
{
var cur = ishihara.framePixels.getPixel(x, y);
var cs = StringTools.hex(cur, 6);
var r = Std.parseInt("0x" + cs.substr(0, 2));
var g = Std.parseInt("0x" + cs.substr(2, 2));