Skip to content

Instantly share code, notes, and snippets.

View alamboley's full-sized avatar

Aymeric Lamboley alamboley

View GitHub Profile
@alamboley
alamboley / gist:4030440
Created November 7, 2012 09:44
How to change or destroy State (Citrus Engine recipe)
// In the Main class :
public function Main() {
state = new TiledMapGameState();
setTimeout(otherState, 4000);
}
private function otherState():void {
@alamboley
alamboley / gist:4060507
Created November 12, 2012 16:58
How to use the AGameData class (Citrus Engine recipe)
// The AGameData class is an abstract (it should be extend) and dynamic class (you won't have problem
// to access its chidren properties, be careful your IDE may not indicate children properties).
public class MyGameData extends AGameData {
public function MyGameData() {
super();
_levels = [[Level1, "levels/A1/LevelA1.swf"], [Level2, "levels/A2/LevelA2.swf"]];
}
@alamboley
alamboley / gist:4565837
Last active December 11, 2015 07:19
How to manage deeply z-sorting (Citrus Engine recipe)
// In your GameState class extending StarlingState (working for State and Away3DState too).
override public function initialize():void {
super.initialize();
// The group property specifies the depth sorting: objects placed in group 1 will be behind objects placed in group 2.
// Here both objects have the same group, therefore the first added will be behind the second.
var cs1:CitrusSprite = new CitrusSprite("cs1", {x:100, y:100, group:5, view:new Quad(100, 100, 0xFF0000)});
add(cs1);