/**** * Initialize Game ****/ //<Assets used in the game will automatically appear here> //<Write imports for supported plugins here> //<Write entity 'classes' with empty functions for important behavior here> var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ // Create a button var button = LK.getAsset('button', { text: 'Click me', x: 1024, y: 1366, width: 200, height: 100, onClick: function onClick() { console.log('Button clicked'); } }); // Add the button to the game game.addChild(button);
===================================================================
--- original.js
+++ change.js
@@ -11,9 +11,9 @@
/****
* Game Code
****/
// Create a button
-var button = new LK.Button({
+var button = LK.getAsset('button', {
text: 'Click me',
x: 1024,
y: 1366,
width: 200,