Rotate objects
Set the rotation angles of your objects
You can change the rotation of an object by calling sceneObject.setRotation(). You can also control the rotation of individual sprites, in exactly the same way: sprite.setRotation().
App = function()
{
var rotation = 0; // the current rotation angle, in radians
this.init = function()
{
// create a text object and add it to the scene
var textSprite = new TextSprite('Click to rotate', '32px Arial', 'blue', 'center');
this.obj = new SceneObject(textSprite);
wade.addSceneObject(this.obj);
};
this.onMouseDown = function()
{
// add a little bit to the rotation angle for each click
rotation += 0.3;
this.obj.setRotation(rotation);
};
};
Your code was executed successfully!