/**** * Classes ****/ // Ice class var Ice = Container.expand(function () { var self = Container.call(this); var iceGraphics = self.attachAsset('ice', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Ice specific update logic }; }); //<Assets used in the game will automatically appear here> // Lemon class var Lemon = Container.expand(function () { var self = Container.call(this); var lemonGraphics = self.attachAsset('lemon', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Lemon specific update logic }; }); // LemonadeStand class var LemonadeStand = Container.expand(function () { var self = Container.call(this); var standGraphics = self.attachAsset('stand', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Lemonade stand specific update logic }; }); // Sugar class var Sugar = Container.expand(function () { var self = Container.call(this); var sugarGraphics = self.attachAsset('sugar', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Sugar specific update logic }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB // Init game with sky blue background }); /**** * Game Code ****/ var lemons = []; var sugars = []; var ices = []; var lemonadeStand; var scoreTxt; var score = 0; var background = game.addChild(LK.getAsset('background', { anchorX: 0, anchorY: 0, scaleX: 1.15, scaleY: 1.15 })); // Initialize game elements function initGameElements() { // Create and position lemons for (var i = 0; i < 5; i++) { var lemon = new Lemon(); lemon.x = Math.random() * 2048; lemon.y = Math.random() * 2732; lemons.push(lemon); game.addChild(lemon); } // Create and position sugars for (var i = 0; i < 5; i++) { var sugar = new Sugar(); sugar.x = Math.random() * 2048; sugar.y = Math.random() * 2732; sugars.push(sugar); game.addChild(sugar); } // Create and position ices for (var i = 0; i < 5; i++) { var ice = new Ice(); ice.x = Math.random() * 2048; ice.y = Math.random() * 2732; ices.push(ice); game.addChild(ice); } // Create and position lemonade stand lemonadeStand = new LemonadeStand(); lemonadeStand.x = 2048 / 2; lemonadeStand.y = 2732 - 200; game.addChild(lemonadeStand); // Create and position score text scoreTxt = new Text2('Score: 0', { size: 100, fill: "#ffffff" }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); } // Update score function updateScore() { scoreTxt.setText('Score: ' + score); } // Handle move events function handleMove(x, y, obj) { // Check for collisions with lemons for (var i = lemons.length - 1; i >= 0; i--) { if (lemons[i].intersects(lemonadeStand)) { score += 10; updateScore(); lemons[i].destroy(); lemons.splice(i, 1); } } // Check for collisions with sugars for (var i = sugars.length - 1; i >= 0; i--) { if (sugars[i].intersects(lemonadeStand)) { score += 10; updateScore(); sugars[i].destroy(); sugars.splice(i, 1); } } // Check for collisions with ices for (var i = ices.length - 1; i >= 0; i--) { if (ices[i].intersects(lemonadeStand)) { score += 10; updateScore(); ices[i].destroy(); ices.splice(i, 1); } } } // Initialize game elements game.setChildIndex(background, 0); initGameElements(); // Set game move event game.move = handleMove; // Game update function game.update = function () { // Update all game elements lemons.forEach(function (lemon) { lemon.update(); }); sugars.forEach(function (sugar) { sugar.update(); }); ices.forEach(function (ice) { ice.update(); }); lemonadeStand.update(); };
===================================================================
--- original.js
+++ change.js
@@ -64,9 +64,11 @@
var scoreTxt;
var score = 0;
var background = game.addChild(LK.getAsset('background', {
anchorX: 0,
- anchorY: 0
+ anchorY: 0,
+ scaleX: 1.15,
+ scaleY: 1.15
}));
// Initialize game elements
function initGameElements() {
// Create and position lemons
A beautiful scenery looking out to sea from an empty beach side promenade on a bright summer day. Happy game illustration style for a casual family friendly game.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
remove the glass and the crate of lemons from the table.
A simple, elegant white speech bubble.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A lemon with a few slices cut off.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A bag of white sugar, open and with a pile of the sugar in front of it.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A pitcher full of nice fresh water and ice cubes.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A round white button for an interface element.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
An empty drinking glass.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A yellow star. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A red heart. simple.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A nice glass of watermelon and strawberry slushice. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A nice glass of banana milkshake. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A nice glass of pina colada. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A nice glass of mango lassie. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
An orange. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A couple of blueberries. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A couple of bananas. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A bottle of milk. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A watermelon and some pieces of watermelon. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A mango and a few slices of mango. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A pineapple with a few slices of pineapple in front. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A fullscreen background gui element for an in-game shop. It should be mostly blanks space, but along the edges there could be some structure or decorative vines and items, mostly related to fruits, berries, cocktails in a summer theme.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A modern dream of a sailing boat. game illustration.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A bold green checkmark.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
An idyllic llustration of a beach cove where a blnd girl in a strawhat i en joying an enormous strawberry drink on her sailing boat as the sun sets. Clean game art illustration style.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
An idyllic llustration of a beach cove where a blond girl in a straw hat is enjoying an large strawberry drink on the deck of her sailing boat as the sun sets. Clean game illustration style.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.