User prompt
make it smaller and under the score
User prompt
make an hi-score
User prompt
bigger
User prompt
make the score bigger
User prompt
change the button to a different color every time it is clicked
User prompt
make a sound when the button clicked
User prompt
make the cursor button swing
User prompt
make a background
User prompt
set font to .VnAvant
User prompt
make the foont bald
User prompt
make the font bold
User prompt
Change the font of the score text to 'Calibri'
User prompt
set font to time new roman
User prompt
add a cursor button
Initial prompt
Click
/**** * Classes ****/ //<Assets used in the game will automatically appear here> // Define a simple Button class that will be used for the tap target var Button = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.attachAsset('button', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // No specific update logic for the button }; // Add a cursor to the button self.cursor = 'pointer'; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ // Initialize score and score text var score = 0; var scoreTxt = new Text2('0', { size: 150, fill: "#ffffff", font: "'.VnAvant', serif", fontWeight: 'bold' }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Create the button and position it at the center of the screen var background = game.addChild(LK.getAsset('background', { anchorX: 0, anchorY: 0 })); var button = game.addChild(new Button()); button.x = 2048 / 2; button.y = 2732 / 2; // Update score function function updateScore() { score += 1; scoreTxt.setText(score); } // Handle button press button.down = function (x, y, obj) { updateScore(); // Flash the button to give feedback LK.effects.flashObject(button, 0xff0000, 100); }; // Game update function game.update = function () { // No specific update logic for the game };
===================================================================
--- original.js
+++ change.js
@@ -36,8 +36,12 @@
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Create the button and position it at the center of the screen
+var background = game.addChild(LK.getAsset('background', {
+ anchorX: 0,
+ anchorY: 0
+}));
var button = game.addChild(new Button());
button.x = 2048 / 2;
button.y = 2732 / 2;
// Update score function