Reputation: 1
setScale()
doesn't work either.
I was going to flip the camera for when something interesting happens, but I don't how how.
Upvotes: 0
Views: 399
Reputation: 31
You could flip the camera (and apply other interesting effects) with shaders!
FlxCamera
has a function called setFilters()
that allows you to add a list of bitmap filters to an active camera.
Here's a simple filter I wrote that flips all textures horizontally:
import openfl.filters.ShaderFilter;
var filters:Array<BitmapFilter> = [];
// Add a filter that flips everything horizontally
var filter = new ShaderFilter(new FlipXAxis());
filters.push(filter);
// Apply filters to camera
FlxG.camera.setFilters(filters);
And in a separate class called FlipXAxis
:
import flixel.system.FlxAssets.FlxShader;
class FlipXAxis extends FlxShader
{
@:glFragmentSource('
#pragma header
void main()
{
vec2 uv = vec2(1.0 - openfl_TextureCoordv.x, openfl_TextureCoordv.y);
gl_FragColor = texture2D(bitmap, uv);
}')
public function new()
{
super();
}
}
Upvotes: 0