public function new() {
_emitter = mold.createEmitter();
_emitter.space = EmitterSpace.View; // This is the feature I am hoping for
owner.add(_emitter);
_emitter.anchorX._ = 5;
_emitter.anchorY._ = 5;
}
override public function onUpdate(dt:Float):Void {
_emitter.enable = _input.thrust.isDown;
}
But, instead I am having to figure out some hacky math to get this working as. If this is already possible, PLEASE let me know how. Also, if there is a working example, please direct me to it... I'm struggling to follow the transformations in the flambe source as I am new to the engine.
As far as creating a pull request for this now, I think all that really needs to be done is is create the EmitterSpace enum and create a switch/if in the draw function of EmitterSprite that draws the sprites correctly. Am I on the right track or am I way off?
override public function onUpdate(dt:Float):Void {
_emitter.enabled = _button.isDown;
if(_emitter.enabled) {
var vm = _anchor.getViewMatrix();
vm.transform(0, 0, _emitPoint);
_emitter.emitX._ = _emitPoint.x / _ctx.scaler.scale;
_emitter.emitY._ = _emitPoint.y / _ctx.scaler.scale;
_emitter.angle._ = -_player.rotation._ - 90;
}
}
_anchor is a Sprite that is a child of the player ship.
_ctx.scaler is a game scaling class that controls a sprite just like in Marks wiki: https://github.com/markknol/flambe-guide/wiki/Responsive-game
The tricky bit here is, everything works just peachy when the scale is 1:1. But once the game is scaled, that is where the issues come in.