Objects with multiple sprites

Create a single object with multiple sprites tied together

When constructing a SceneObject, you can use an array of sprites rather than a single sprite. Alternatively, you can use its AddSprite and RemoveSprite methods to add and remove sprites after it's been constructed.
App = function() { this.load = function() { wade.loadImage('/snippets/samples/cc_logo.png'); wade.loadImage('/snippets/samples/callout.png'); }; this.init = function() { // create two image sprites, and one text sprite var logo = new Sprite('/snippets/samples/cc_logo.png'); var callout = new Sprite('/snippets/samples/callout.png'); var text = new TextSprite('Hello World Wide Web', '22px Arial', 'blue', 'center'); // create an object using an array of sprites var obj = new SceneObject([logo, callout, text]); // set an offset for the callout and text sprites obj.setSpriteOffset(1, {x:-100, y: -140}); obj.setSpriteOffset(2, {x:-100, y: -145}); // add the object to the scene wade.addSceneObject(obj); // move the object (and all its sprites) obj.moveTo(100, 100, 100); }; };
Your code was executed successfully!