User prompt
Add humans
User prompt
Make an new item called Pepto-Bismol (gives you +1 health)
User prompt
Add an new item called Painkiller (+1 healt
User prompt
Please fix the bug: 'TypeError: Cannot set properties of undefined (setting 'fill')' in or related to this line: 'countriesVisitedTxt.style.fill = 0xCD7F32; // Bronze' Line Number: 926
User prompt
Add traveling to different countries
User prompt
Add drowning
User prompt
Can you use a different asset, the Atomic bomb has different looks and usage so
User prompt
Add a eurovision flashbang ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Now add chocolate (When it sppears, the swan follows it instead and consumes it.)
User prompt
Can you add a atomic bomb
Code edit (1 edits merged)
Please save this source code
User prompt
Goose Chase: Battle for Chips
Initial prompt
Make a completely functional but unplayable game where a goose eats chips but tries to beat the hell out of a angry swan.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var Chip = Container.expand(function () { var self = Container.call(this); var chipGraphic = self.attachAsset('chip', { anchorX: 0.5, anchorY: 0.5 }); self.isCollected = false; self.collect = function () { if (!self.isCollected) { self.isCollected = true; LK.getSound('eat').play(); tween(self, { alpha: 0, scaleX: 0.1, scaleY: 0.1 }, { duration: 300, onFinish: function onFinish() { self.visible = false; } }); return true; } return false; }; return self; }); var Goose = Container.expand(function () { var self = Container.call(this); // Body var body = self.attachAsset('goose', { anchorX: 0.5, anchorY: 0.5 }); // Wings var leftWing = LK.getAsset('gooseWing', { anchorX: 0, anchorY: 0.5, x: -80, y: 0, rotation: -0.3 }); var rightWing = LK.getAsset('gooseWing', { anchorX: 1, anchorY: 0.5, x: 80, y: 0, rotation: 0.3 }); // Beak var beak = LK.getAsset('gooseBeak', { anchorX: 0, anchorY: 0.5, x: 80, y: 0 }); self.addChild(leftWing); self.addChild(rightWing); self.addChild(beak); self.speed = 7; self.attackCooldown = 0; self.isAttacking = false; self.stunned = 0; self.attack = function () { if (self.attackCooldown <= 0 && !self.isAttacking && self.stunned <= 0) { self.isAttacking = true; LK.getSound('honk').play(); // Wing attack animation tween(leftWing, { rotation: -0.8, x: -100 }, { duration: 200, easing: tween.easeOut }); tween(rightWing, { rotation: 0.8, x: 100 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { // Return wings to normal tween(leftWing, { rotation: -0.3, x: -80 }, { duration: 300, easing: tween.easeInOut }); tween(rightWing, { rotation: 0.3, x: 80 }, { duration: 300, easing: tween.easeInOut, onFinish: function onFinish() { self.isAttacking = false; } }); self.attackCooldown = 60; // 1 second cooldown (60 frames) } }); return true; } return false; }; self.stun = function (duration) { self.stunned = duration; // Stun animation tween(self, { alpha: 0.6 }, { duration: 100, onFinish: function onFinish() { tween(self, { alpha: 1 }, { duration: 100 }); } }); }; self.update = function () { if (self.attackCooldown > 0) { self.attackCooldown--; } if (self.stunned > 0) { self.stunned--; } }; return self; }); var Pond = Container.expand(function () { var self = Container.call(this); var pondGraphic = self.attachAsset('pond', { anchorX: 0.5, anchorY: 0.5 }); return self; }); var Swan = Container.expand(function () { var self = Container.call(this); // Body var body = self.attachAsset('swan', { anchorX: 0.5, anchorY: 0.5 }); // Wings var leftWing = LK.getAsset('swanWing', { anchorX: 0, anchorY: 0.5, x: -90, y: 0, rotation: -0.3 }); var rightWing = LK.getAsset('swanWing', { anchorX: 1, anchorY: 0.5, x: 90, y: 0, rotation: 0.3 }); // Beak var beak = LK.getAsset('swanBeak', { anchorX: 0, anchorY: 0.5, x: 90, y: 0 }); self.addChild(leftWing); self.addChild(rightWing); self.addChild(beak); self.speed = 3; self.targetX = 0; self.targetY = 0; self.aggressionLevel = 1; self.attackCooldown = 0; self.isAttacking = false; self.stunned = 0; self.setTarget = function (x, y) { self.targetX = x; self.targetY = y; }; self.attack = function () { if (self.attackCooldown <= 0 && !self.isAttacking && self.stunned <= 0) { self.isAttacking = true; LK.getSound('swanAttack').play(); // Attack animation var originalX = self.x; var originalY = self.y; // Calculate direction toward goose var dx = self.targetX - self.x; var dy = self.targetY - self.y; var dist = Math.sqrt(dx * dx + dy * dy); var normalizedX = dx / dist; var normalizedY = dy / dist; // Quick lunge animation tween(self, { x: self.x + normalizedX * 150, y: self.y + normalizedY * 150 }, { duration: 300, easing: tween.easeOut, onFinish: function onFinish() { // Return to original position tween(self, { x: originalX, y: originalY }, { duration: 500, easing: tween.easeInOut, onFinish: function onFinish() { self.isAttacking = false; } }); self.attackCooldown = Math.max(30, 120 - self.aggressionLevel * 10); // Cooldown decreases with aggression } }); return true; } return false; }; self.stun = function (duration) { self.stunned = duration; // Stun animation tween(self, { alpha: 0.6 }, { duration: 100, onFinish: function onFinish() { tween(self, { alpha: 1 }, { duration: 100 }); } }); }; self.increaseAggression = function () { self.aggressionLevel = Math.min(8, self.aggressionLevel + 0.25); self.speed = 3 + self.aggressionLevel * 0.4; }; self.update = function () { if (self.stunned > 0) { self.stunned--; return; } if (self.attackCooldown > 0) { self.attackCooldown--; } if (!self.isAttacking) { // Move toward target var dx = self.targetX - self.x; var dy = self.targetY - self.y; var dist = Math.sqrt(dx * dx + dy * dy); if (dist > 10) { var speed = self.speed; self.x += dx / dist * speed; self.y += dy / dist * speed; // Rotate toward movement direction self.rotation = Math.atan2(dy, dx); } // Try to attack if close enough if (dist < 250 && Math.random() < 0.03 * self.aggressionLevel) { self.attack(); } } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB // Sky blue background }); /**** * Game Code ****/ // Game variables var goose; var swan; var pond; var chips = []; var chipCount = 15; var dragNode = null; var lastIntersecting = false; var gameActive = true; var highScore = storage.highScore || 0; // Initialize the game UI var scoreTxt = new Text2('0', { size: 80, fill: 0xFFFFFF }); scoreTxt.setText("Score: " + LK.getScore()); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); var highScoreTxt = new Text2('0', { size: 50, fill: 0xFFFFFF }); highScoreTxt.setText("High Score: " + highScore); highScoreTxt.anchor.set(0.5, 0); highScoreTxt.y = 90; LK.gui.top.addChild(highScoreTxt); // Create the pond (play area) pond = game.addChild(new Pond()); pond.x = 2048 / 2; pond.y = 2732 / 2; // Create the goose (player character) goose = game.addChild(new Goose()); goose.x = 2048 / 2; goose.y = 2732 / 2 + 600; // Create the swan (enemy) swan = game.addChild(new Swan()); swan.x = 2048 / 2; swan.y = 2732 / 2 - 600; // Spawn chips around the pond function spawnChips() { for (var i = 0; i < chipCount; i++) { var chip = new Chip(); var angle = Math.random() * Math.PI * 2; var distance = Math.random() * 700 + 200; chip.x = pond.x + Math.cos(angle) * distance; chip.y = pond.y + Math.sin(angle) * distance; // Make sure chips are within pond boundaries var dx = chip.x - pond.x; var dy = chip.y - pond.y; var dist = Math.sqrt(dx * dx + dy * dy); if (dist > 850) { // Adjust to keep within pond chip.x = pond.x + dx / dist * 850; chip.y = pond.y + dy / dist * 850; } chips.push(chip); game.addChild(chip); } } // Spawn initial chips spawnChips(); // Play background music LK.playMusic('bgMusic', { loop: true }); // Handle movement function handleMove(x, y, obj) { if (dragNode && gameActive) { // Limit goose movement to within the pond boundaries var dx = x - pond.x; var dy = y - pond.y; var dist = Math.sqrt(dx * dx + dy * dy); if (dist > 850) { // Keep goose within the pond boundaries dragNode.x = pond.x + dx / dist * 850; dragNode.y = pond.y + dy / dist * 850; } else { dragNode.x = x; dragNode.y = y; } // Rotate toward movement direction var moveAngle = Math.atan2(y - dragNode.y, x - dragNode.x); dragNode.rotation = moveAngle; } } // Mouse/touch events game.move = handleMove; game.down = function (x, y, obj) { if (gameActive) { dragNode = goose; handleMove(x, y, obj); // Attack on tap/click goose.attack(); } }; game.up = function (x, y, obj) { dragNode = null; }; // Main game update loop game.update = function () { if (!gameActive) return; // Update game entities goose.update(); swan.update(); // Set swan target to goose position swan.setTarget(goose.x, goose.y); // Check for goose collecting chips for (var i = chips.length - 1; i >= 0; i--) { if (!chips[i].isCollected && goose.intersects(chips[i])) { if (chips[i].collect()) { // Increase score LK.setScore(LK.getScore() + 1); scoreTxt.setText("Score: " + LK.getScore()); // Increase swan aggression swan.increaseAggression(); // Remove the chip from the array chips.splice(i, 1); // Spawn a new chip if needed if (chips.length < 5) { var chip = new Chip(); var angle = Math.random() * Math.PI * 2; var distance = Math.random() * 700 + 200; chip.x = pond.x + Math.cos(angle) * distance; chip.y = pond.y + Math.sin(angle) * distance; chips.push(chip); game.addChild(chip); } } } } // Check for goose attack hitting swan if (goose.isAttacking && goose.intersects(swan) && swan.stunned <= 0) { LK.getSound('hit').play(); swan.stun(60); // Stun for 1 second (60 frames) // Push swan away slightly var dx = swan.x - goose.x; var dy = swan.y - goose.y; var dist = Math.sqrt(dx * dx + dy * dy); if (dist > 0) { tween(swan, { x: swan.x + dx / dist * 100, y: swan.y + dy / dist * 100 }, { duration: 300, easing: tween.easeOut }); } } // Check for swan attack hitting goose if (swan.isAttacking && swan.intersects(goose) && goose.stunned <= 0) { LK.getSound('hit').play(); goose.stun(30); // Stun for 0.5 seconds (30 frames) // Game over if swan's aggression is high enough (after collecting enough chips) if (swan.aggressionLevel > 7) { // Update high score if needed if (LK.getScore() > highScore) { highScore = LK.getScore(); storage.highScore = highScore; highScoreTxt.setText("High Score: " + highScore); } // Flash screen red LK.effects.flashScreen(0xff0000, 1000); // End the game gameActive = false; LK.showGameOver(); } } // Win condition: collect 50 chips if (LK.getScore() >= 50) { // Update high score if (LK.getScore() > highScore) { highScore = LK.getScore(); storage.highScore = highScore; highScoreTxt.setText("High Score: " + highScore); } // End the game with a win gameActive = false; LK.showYouWin(); } };
===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,471 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+var storage = LK.import("@upit/storage.v1");
+
+/****
+* Classes
+****/
+var Chip = Container.expand(function () {
+ var self = Container.call(this);
+ var chipGraphic = self.attachAsset('chip', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.isCollected = false;
+ self.collect = function () {
+ if (!self.isCollected) {
+ self.isCollected = true;
+ LK.getSound('eat').play();
+ tween(self, {
+ alpha: 0,
+ scaleX: 0.1,
+ scaleY: 0.1
+ }, {
+ duration: 300,
+ onFinish: function onFinish() {
+ self.visible = false;
+ }
+ });
+ return true;
+ }
+ return false;
+ };
+ return self;
+});
+var Goose = Container.expand(function () {
+ var self = Container.call(this);
+ // Body
+ var body = self.attachAsset('goose', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ // Wings
+ var leftWing = LK.getAsset('gooseWing', {
+ anchorX: 0,
+ anchorY: 0.5,
+ x: -80,
+ y: 0,
+ rotation: -0.3
+ });
+ var rightWing = LK.getAsset('gooseWing', {
+ anchorX: 1,
+ anchorY: 0.5,
+ x: 80,
+ y: 0,
+ rotation: 0.3
+ });
+ // Beak
+ var beak = LK.getAsset('gooseBeak', {
+ anchorX: 0,
+ anchorY: 0.5,
+ x: 80,
+ y: 0
+ });
+ self.addChild(leftWing);
+ self.addChild(rightWing);
+ self.addChild(beak);
+ self.speed = 7;
+ self.attackCooldown = 0;
+ self.isAttacking = false;
+ self.stunned = 0;
+ self.attack = function () {
+ if (self.attackCooldown <= 0 && !self.isAttacking && self.stunned <= 0) {
+ self.isAttacking = true;
+ LK.getSound('honk').play();
+ // Wing attack animation
+ tween(leftWing, {
+ rotation: -0.8,
+ x: -100
+ }, {
+ duration: 200,
+ easing: tween.easeOut
+ });
+ tween(rightWing, {
+ rotation: 0.8,
+ x: 100
+ }, {
+ duration: 200,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ // Return wings to normal
+ tween(leftWing, {
+ rotation: -0.3,
+ x: -80
+ }, {
+ duration: 300,
+ easing: tween.easeInOut
+ });
+ tween(rightWing, {
+ rotation: 0.3,
+ x: 80
+ }, {
+ duration: 300,
+ easing: tween.easeInOut,
+ onFinish: function onFinish() {
+ self.isAttacking = false;
+ }
+ });
+ self.attackCooldown = 60; // 1 second cooldown (60 frames)
+ }
+ });
+ return true;
+ }
+ return false;
+ };
+ self.stun = function (duration) {
+ self.stunned = duration;
+ // Stun animation
+ tween(self, {
+ alpha: 0.6
+ }, {
+ duration: 100,
+ onFinish: function onFinish() {
+ tween(self, {
+ alpha: 1
+ }, {
+ duration: 100
+ });
+ }
+ });
+ };
+ self.update = function () {
+ if (self.attackCooldown > 0) {
+ self.attackCooldown--;
+ }
+ if (self.stunned > 0) {
+ self.stunned--;
+ }
+ };
+ return self;
+});
+var Pond = Container.expand(function () {
+ var self = Container.call(this);
+ var pondGraphic = self.attachAsset('pond', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ return self;
+});
+var Swan = Container.expand(function () {
+ var self = Container.call(this);
+ // Body
+ var body = self.attachAsset('swan', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ // Wings
+ var leftWing = LK.getAsset('swanWing', {
+ anchorX: 0,
+ anchorY: 0.5,
+ x: -90,
+ y: 0,
+ rotation: -0.3
+ });
+ var rightWing = LK.getAsset('swanWing', {
+ anchorX: 1,
+ anchorY: 0.5,
+ x: 90,
+ y: 0,
+ rotation: 0.3
+ });
+ // Beak
+ var beak = LK.getAsset('swanBeak', {
+ anchorX: 0,
+ anchorY: 0.5,
+ x: 90,
+ y: 0
+ });
+ self.addChild(leftWing);
+ self.addChild(rightWing);
+ self.addChild(beak);
+ self.speed = 3;
+ self.targetX = 0;
+ self.targetY = 0;
+ self.aggressionLevel = 1;
+ self.attackCooldown = 0;
+ self.isAttacking = false;
+ self.stunned = 0;
+ self.setTarget = function (x, y) {
+ self.targetX = x;
+ self.targetY = y;
+ };
+ self.attack = function () {
+ if (self.attackCooldown <= 0 && !self.isAttacking && self.stunned <= 0) {
+ self.isAttacking = true;
+ LK.getSound('swanAttack').play();
+ // Attack animation
+ var originalX = self.x;
+ var originalY = self.y;
+ // Calculate direction toward goose
+ var dx = self.targetX - self.x;
+ var dy = self.targetY - self.y;
+ var dist = Math.sqrt(dx * dx + dy * dy);
+ var normalizedX = dx / dist;
+ var normalizedY = dy / dist;
+ // Quick lunge animation
+ tween(self, {
+ x: self.x + normalizedX * 150,
+ y: self.y + normalizedY * 150
+ }, {
+ duration: 300,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ // Return to original position
+ tween(self, {
+ x: originalX,
+ y: originalY
+ }, {
+ duration: 500,
+ easing: tween.easeInOut,
+ onFinish: function onFinish() {
+ self.isAttacking = false;
+ }
+ });
+ self.attackCooldown = Math.max(30, 120 - self.aggressionLevel * 10); // Cooldown decreases with aggression
+ }
+ });
+ return true;
+ }
+ return false;
+ };
+ self.stun = function (duration) {
+ self.stunned = duration;
+ // Stun animation
+ tween(self, {
+ alpha: 0.6
+ }, {
+ duration: 100,
+ onFinish: function onFinish() {
+ tween(self, {
+ alpha: 1
+ }, {
+ duration: 100
+ });
+ }
+ });
+ };
+ self.increaseAggression = function () {
+ self.aggressionLevel = Math.min(8, self.aggressionLevel + 0.25);
+ self.speed = 3 + self.aggressionLevel * 0.4;
+ };
+ self.update = function () {
+ if (self.stunned > 0) {
+ self.stunned--;
+ return;
+ }
+ if (self.attackCooldown > 0) {
+ self.attackCooldown--;
+ }
+ if (!self.isAttacking) {
+ // Move toward target
+ var dx = self.targetX - self.x;
+ var dy = self.targetY - self.y;
+ var dist = Math.sqrt(dx * dx + dy * dy);
+ if (dist > 10) {
+ var speed = self.speed;
+ self.x += dx / dist * speed;
+ self.y += dy / dist * speed;
+ // Rotate toward movement direction
+ self.rotation = Math.atan2(dy, dx);
+ }
+ // Try to attack if close enough
+ if (dist < 250 && Math.random() < 0.03 * self.aggressionLevel) {
+ self.attack();
+ }
+ }
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x87CEEB // Sky blue background
+});
+
+/****
+* Game Code
+****/
+// Game variables
+var goose;
+var swan;
+var pond;
+var chips = [];
+var chipCount = 15;
+var dragNode = null;
+var lastIntersecting = false;
+var gameActive = true;
+var highScore = storage.highScore || 0;
+// Initialize the game UI
+var scoreTxt = new Text2('0', {
+ size: 80,
+ fill: 0xFFFFFF
+});
+scoreTxt.setText("Score: " + LK.getScore());
+scoreTxt.anchor.set(0.5, 0);
+LK.gui.top.addChild(scoreTxt);
+var highScoreTxt = new Text2('0', {
+ size: 50,
+ fill: 0xFFFFFF
+});
+highScoreTxt.setText("High Score: " + highScore);
+highScoreTxt.anchor.set(0.5, 0);
+highScoreTxt.y = 90;
+LK.gui.top.addChild(highScoreTxt);
+// Create the pond (play area)
+pond = game.addChild(new Pond());
+pond.x = 2048 / 2;
+pond.y = 2732 / 2;
+// Create the goose (player character)
+goose = game.addChild(new Goose());
+goose.x = 2048 / 2;
+goose.y = 2732 / 2 + 600;
+// Create the swan (enemy)
+swan = game.addChild(new Swan());
+swan.x = 2048 / 2;
+swan.y = 2732 / 2 - 600;
+// Spawn chips around the pond
+function spawnChips() {
+ for (var i = 0; i < chipCount; i++) {
+ var chip = new Chip();
+ var angle = Math.random() * Math.PI * 2;
+ var distance = Math.random() * 700 + 200;
+ chip.x = pond.x + Math.cos(angle) * distance;
+ chip.y = pond.y + Math.sin(angle) * distance;
+ // Make sure chips are within pond boundaries
+ var dx = chip.x - pond.x;
+ var dy = chip.y - pond.y;
+ var dist = Math.sqrt(dx * dx + dy * dy);
+ if (dist > 850) {
+ // Adjust to keep within pond
+ chip.x = pond.x + dx / dist * 850;
+ chip.y = pond.y + dy / dist * 850;
+ }
+ chips.push(chip);
+ game.addChild(chip);
+ }
+}
+// Spawn initial chips
+spawnChips();
+// Play background music
+LK.playMusic('bgMusic', {
+ loop: true
+});
+// Handle movement
+function handleMove(x, y, obj) {
+ if (dragNode && gameActive) {
+ // Limit goose movement to within the pond boundaries
+ var dx = x - pond.x;
+ var dy = y - pond.y;
+ var dist = Math.sqrt(dx * dx + dy * dy);
+ if (dist > 850) {
+ // Keep goose within the pond boundaries
+ dragNode.x = pond.x + dx / dist * 850;
+ dragNode.y = pond.y + dy / dist * 850;
+ } else {
+ dragNode.x = x;
+ dragNode.y = y;
+ }
+ // Rotate toward movement direction
+ var moveAngle = Math.atan2(y - dragNode.y, x - dragNode.x);
+ dragNode.rotation = moveAngle;
+ }
+}
+// Mouse/touch events
+game.move = handleMove;
+game.down = function (x, y, obj) {
+ if (gameActive) {
+ dragNode = goose;
+ handleMove(x, y, obj);
+ // Attack on tap/click
+ goose.attack();
+ }
+};
+game.up = function (x, y, obj) {
+ dragNode = null;
+};
+// Main game update loop
+game.update = function () {
+ if (!gameActive) return;
+ // Update game entities
+ goose.update();
+ swan.update();
+ // Set swan target to goose position
+ swan.setTarget(goose.x, goose.y);
+ // Check for goose collecting chips
+ for (var i = chips.length - 1; i >= 0; i--) {
+ if (!chips[i].isCollected && goose.intersects(chips[i])) {
+ if (chips[i].collect()) {
+ // Increase score
+ LK.setScore(LK.getScore() + 1);
+ scoreTxt.setText("Score: " + LK.getScore());
+ // Increase swan aggression
+ swan.increaseAggression();
+ // Remove the chip from the array
+ chips.splice(i, 1);
+ // Spawn a new chip if needed
+ if (chips.length < 5) {
+ var chip = new Chip();
+ var angle = Math.random() * Math.PI * 2;
+ var distance = Math.random() * 700 + 200;
+ chip.x = pond.x + Math.cos(angle) * distance;
+ chip.y = pond.y + Math.sin(angle) * distance;
+ chips.push(chip);
+ game.addChild(chip);
+ }
+ }
+ }
+ }
+ // Check for goose attack hitting swan
+ if (goose.isAttacking && goose.intersects(swan) && swan.stunned <= 0) {
+ LK.getSound('hit').play();
+ swan.stun(60); // Stun for 1 second (60 frames)
+ // Push swan away slightly
+ var dx = swan.x - goose.x;
+ var dy = swan.y - goose.y;
+ var dist = Math.sqrt(dx * dx + dy * dy);
+ if (dist > 0) {
+ tween(swan, {
+ x: swan.x + dx / dist * 100,
+ y: swan.y + dy / dist * 100
+ }, {
+ duration: 300,
+ easing: tween.easeOut
+ });
+ }
+ }
+ // Check for swan attack hitting goose
+ if (swan.isAttacking && swan.intersects(goose) && goose.stunned <= 0) {
+ LK.getSound('hit').play();
+ goose.stun(30); // Stun for 0.5 seconds (30 frames)
+ // Game over if swan's aggression is high enough (after collecting enough chips)
+ if (swan.aggressionLevel > 7) {
+ // Update high score if needed
+ if (LK.getScore() > highScore) {
+ highScore = LK.getScore();
+ storage.highScore = highScore;
+ highScoreTxt.setText("High Score: " + highScore);
+ }
+ // Flash screen red
+ LK.effects.flashScreen(0xff0000, 1000);
+ // End the game
+ gameActive = false;
+ LK.showGameOver();
+ }
+ }
+ // Win condition: collect 50 chips
+ if (LK.getScore() >= 50) {
+ // Update high score
+ if (LK.getScore() > highScore) {
+ highScore = LK.getScore();
+ storage.highScore = highScore;
+ highScoreTxt.setText("High Score: " + highScore);
+ }
+ // End the game with a win
+ gameActive = false;
+ LK.showYouWin();
+ }
+};
\ No newline at end of file
A potato chip. In-Game asset. 2d. High contrast. No shadows
A pond. Top down view.. In-Game asset. 2d. High contrast. No shadows
Goose. In-Game asset. 2d. High contrast. No shadows
Atomic symbol. In-Game asset. 2d. High contrast. No shadows
A fuming swan with 16 cigarettes. In-Game asset. 2d. High contrast. No shadows