Skip to content

Instantly share code, notes, and snippets.

View Sunjammer's full-sized avatar

Andreas Rønning Sunjammer

  • Trondheim, Norway
View GitHub Profile
@Sunjammer
Sunjammer / Difficulty curve
Last active August 29, 2015 14:16
Difficulty curve generation
inline function shape(input:Float, drive:Float):Float{
var k:Float = 2.0 * drive / (1.0 - drive);
return (1.0 + k) * input / (1.0 + k * Math.abs(input));
}
inline function tri(a:Float, x:Float):Float {
x = x / (2.0*Math.PI);
x = x % 1.0;
if( x<0.0 ) x = 1.0+x;
if(x<a) x=x/a; else x=1.0-(x-a)/(1.0-a);
@Sunjammer
Sunjammer / Music.hx
Last active August 29, 2015 14:11
Very simple Flash/OpenFL music manager for Haxe games
package;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.media.SoundTransform;
import flash.net.URLRequest;
/**
* A simple Flash/OpenFL music manager with optional crossfading
* @author Andreas Rønning
*/
@Sunjammer
Sunjammer / BitmapToAscii.hx
Last active March 22, 2021 03:34
Naive bitmap to ascii converter
package;
/**
* Mostly stolen from http://www.codeproject.com/Articles/20435/Using-C-To-Generate-ASCII-Art-From-An-Image
* @author Andreas Rønning
*/
private typedef BMD = {
function getPixel(x:Int, y:Int):Int;
var width(default, never):Int;
var height(default, never):Int;
@Sunjammer
Sunjammer / destiny.md
Last active August 29, 2015 14:06
Thoughts on Destiny

Destiny is a mysterious game.

It's been a long time since I experienced an arc like this. It's been an intricate rollercoaster. From the moment the game was announced, with its Marathon Infinity callback title, I was genuinely glad for Bungie regaining their freedom. Bungie are a studio I've followed closely ever since playing the Marathon demo on a Mac IIsi (at 25% resolution, interlaced, without floor or ceiling textures no less). The Marathon trilogy and its modding community defined much of my teens, my first encounters with the internet, and my first serious dabblings in game mods. We eagerly awaited Halo only to see it "stolen" by Microsoft, divorcing Bungie from their Mac gaming heritage. After seeing Bungie grind through several Halo games, straining their modest Iain Banks sci-fi fanboy lore far beyond any reasonable limit while simultaneously spending the time constructing a peerless ability to create seamless and immaculately tuned multiplayer games, the prospect of a Bungie "free" from Halo a

@Sunjammer
Sunjammer / FColor.swift
Last active January 10, 2016 17:53
Swift color util for cool friends
import UIKit
public class FColor{
public var a:CGFloat = 1.0;
public var r:CGFloat = 1.0;
public var g:CGFloat = 1.0;
public var b:CGFloat = 1.0;
init(r:CGFloat = 1.0, g:CGFloat = 1.0, b:CGFloat = 1.0, a:CGFloat = 1.0){
self.r = r;