Detecting clicks or taps

Do something when the user clicks (or taps on touch-screen devices)

When the user clicks or taps anywhere, App.onClick is executed (if it exists)
App = function() { this.init = function() { // create a text sprite (we make it a member of the App function so it's accessible from other functions) this.textSprite = new TextSprite('Click anywhere', '32px Arial', 'red', 'center'); // create a scene object this.textObject = new SceneObject(this.textSprite); // add the object to the scene wade.addSceneObject(this.textObject); }; this.onClick = function() { // change the text this.textSprite.setText('Well done!'); }; };
Your code was executed successfully!