Mirroring sprites

Creating a mirror image of an existing sprite

You can mirror a sprite by changing its draw function. WADE provides you with a convenient mirror_ draw function just for this purpose.
App = function() { this.load = function() { wade.loadImage('/snippets/samples/cc_logo.png'); }; this.init = function() { // create an object and add it to the scene var logo = new SceneObject(new Sprite('/snippets/samples/cc_logo.png')); wade.addSceneObject(logo); // clone the object and add the clone to the scene var clonedLogo = logo.clone(); clonedLogo.setPosition(100, 0); wade.addSceneObject(clonedLogo); // mirror the cloned sprite clonedLogo.getSprite().setDrawFunction(wade.drawFunctions.mirror_()); }; };
Your code was executed successfully!