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 AtomicBomb = Container.expand(function () {
var self = Container.call(this);
// Create bomb body (red circle)
var bombBody = self.attachAsset('centerCircle', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.8,
scaleY: 0.8
});
bombBody.tint = 0xff0000;
// Add radiation symbol (yellow)
var radiationSymbol = LK.getAsset('centerCircle', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.3,
scaleY: 0.3
});
radiationSymbol.tint = 0xffff00;
self.addChild(radiationSymbol);
self.explosionRadius = 500;
self.isExploding = false;
self.isCollected = false;
// Bomb collection
self.collect = function () {
if (!self.isCollected) {
self.isCollected = true;
return true;
}
return false;
};
// Explosion effect
self.explode = function () {
if (!self.isExploding) {
self.isExploding = true;
// Create explosion animation
tween(self, {
scaleX: 10,
scaleY: 10,
alpha: 0.7
}, {
duration: 500,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(self, {
alpha: 0
}, {
duration: 300,
onFinish: function onFinish() {
self.visible = false;
}
});
}
});
return true;
}
return false;
};
// Pulse animation for idle bomb
function startPulseAnimation() {
tween(self, {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 800,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(self, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 800,
easing: tween.easeInOut,
onFinish: startPulseAnimation
});
}
});
}
// Start pulsing
startPulseAnimation();
return self;
});
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 Chocolate = Container.expand(function () {
var self = Container.call(this);
// Create chocolate graphic (brown rectangle)
var chocolateBody = self.attachAsset('centerCircle', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.7,
scaleY: 0.5
});
// Set chocolate color to brown
chocolateBody.tint = 0x4B2E20;
// Add inner layer for chocolate texture
var innerLayer = LK.getAsset('centerCircle', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.5,
scaleY: 0.3
});
innerLayer.tint = 0x663C28;
self.addChild(innerLayer);
self.isConsumed = false;
self.timeLeft = 300; // 5 seconds at 60fps
// Swan consumes chocolate
self.consume = function () {
if (!self.isConsumed) {
self.isConsumed = true;
// Consumption animation
tween(self, {
alpha: 0,
scaleX: 0.1,
scaleY: 0.1
}, {
duration: 300,
onFinish: function onFinish() {
self.visible = false;
}
});
return true;
}
return false;
};
self.update = function () {
self.timeLeft--;
// Pulse when about to disappear
if (self.timeLeft < 60) {
self.alpha = 0.5 + Math.sin(self.timeLeft * 0.2) * 0.5;
}
if (self.timeLeft <= 0 && !self.isConsumed) {
self.consume();
}
};
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);
}
// Only try to attack if not targeting chocolate
if (!swanTargetingChocolate && 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;
var atomicBomb = null;
var bombTimer = 0;
var hasBomb = false;
var chocolate = null;
var chocolateTimer = 0;
var swanNormalTarget = {
x: 0,
y: 0
};
var swanTargetingChocolate = false;
// 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();
// Special effect when having atomic bomb
if (hasBomb) {
LK.effects.flashScreen(0xff0000, 500);
}
}
};
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();
if (chocolate) {
chocolate.update();
}
// Chocolate spawn logic
chocolateTimer++;
if (!chocolate && chocolateTimer > 480 && Math.random() < 0.008) {
chocolate = new Chocolate();
var angle = Math.random() * Math.PI * 2;
var distance = Math.random() * 600 + 150;
chocolate.x = pond.x + Math.cos(angle) * distance;
chocolate.y = pond.y + Math.sin(angle) * distance;
game.addChild(chocolate);
chocolateTimer = 0;
// Store goose position as normal target
swanNormalTarget = {
x: goose.x,
y: goose.y
};
// Make swan target chocolate
swanTargetingChocolate = true;
}
// Set swan target based on chocolate presence
if (swanTargetingChocolate && chocolate && !chocolate.isConsumed) {
swan.setTarget(chocolate.x, chocolate.y);
} else {
swan.setTarget(goose.x, goose.y);
swanTargetingChocolate = false;
}
// Atomic bomb spawn logic
bombTimer++;
if (!atomicBomb && !hasBomb && bombTimer > 600 && Math.random() < 0.005) {
atomicBomb = new AtomicBomb();
var angle = Math.random() * Math.PI * 2;
var distance = Math.random() * 600 + 150;
atomicBomb.x = pond.x + Math.cos(angle) * distance;
atomicBomb.y = pond.y + Math.sin(angle) * distance;
game.addChild(atomicBomb);
bombTimer = 0;
}
// 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();
}
}
// Check for swan consuming chocolate
if (chocolate && !chocolate.isConsumed && swan.intersects(chocolate)) {
if (chocolate.consume()) {
// Swan gets distracted by chocolate
swan.stun(120); // Stun for 2 seconds (120 frames)
swan.aggressionLevel = Math.max(1, swan.aggressionLevel - 1); // Reduce aggression
// Play eating sound
LK.getSound('eat').play();
// Reset chocolate
chocolate = null;
chocolateTimer = 0;
swanTargetingChocolate = false;
}
}
// Check for atomic bomb collection
if (atomicBomb && !hasBomb && goose.intersects(atomicBomb) && atomicBomb.collect()) {
hasBomb = true;
atomicBomb.visible = false;
// Create bomb indicator on goose
var bombIndicator = LK.getAsset('centerCircle', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: -80,
scaleX: 0.3,
scaleY: 0.3
});
bombIndicator.tint = 0xff0000;
goose.addChild(bombIndicator);
LK.getSound('eat').play();
}
// Use atomic bomb when attacking with bomb collected
if (hasBomb && goose.isAttacking) {
hasBomb = false;
// Remove bomb indicator
goose.removeChild(goose.children[goose.children.length - 1]);
// Create explosion at goose position
var explosion = new AtomicBomb();
explosion.x = goose.x;
explosion.y = goose.y;
game.addChild(explosion);
explosion.explode();
// Stun swan for longer period
swan.stun(180);
// Push swan far away
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 * 300,
y: swan.y + dy / dist * 300
}, {
duration: 500,
easing: tween.easeOut
});
}
// Reset bomb variables
atomicBomb = null;
bombTimer = 0;
}
// Check for 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
@@ -114,8 +114,61 @@
return false;
};
return self;
});
+var Chocolate = Container.expand(function () {
+ var self = Container.call(this);
+ // Create chocolate graphic (brown rectangle)
+ var chocolateBody = self.attachAsset('centerCircle', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ scaleX: 0.7,
+ scaleY: 0.5
+ });
+ // Set chocolate color to brown
+ chocolateBody.tint = 0x4B2E20;
+ // Add inner layer for chocolate texture
+ var innerLayer = LK.getAsset('centerCircle', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ scaleX: 0.5,
+ scaleY: 0.3
+ });
+ innerLayer.tint = 0x663C28;
+ self.addChild(innerLayer);
+ self.isConsumed = false;
+ self.timeLeft = 300; // 5 seconds at 60fps
+ // Swan consumes chocolate
+ self.consume = function () {
+ if (!self.isConsumed) {
+ self.isConsumed = true;
+ // Consumption animation
+ tween(self, {
+ alpha: 0,
+ scaleX: 0.1,
+ scaleY: 0.1
+ }, {
+ duration: 300,
+ onFinish: function onFinish() {
+ self.visible = false;
+ }
+ });
+ return true;
+ }
+ return false;
+ };
+ self.update = function () {
+ self.timeLeft--;
+ // Pulse when about to disappear
+ if (self.timeLeft < 60) {
+ self.alpha = 0.5 + Math.sin(self.timeLeft * 0.2) * 0.5;
+ }
+ if (self.timeLeft <= 0 && !self.isConsumed) {
+ self.consume();
+ }
+ };
+ return self;
+});
var Goose = Container.expand(function () {
var self = Container.call(this);
// Body
var body = self.attachAsset('goose', {
@@ -350,10 +403,10 @@
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) {
+ // Only try to attack if not targeting chocolate
+ if (!swanTargetingChocolate && dist < 250 && Math.random() < 0.03 * self.aggressionLevel) {
self.attack();
}
}
};
@@ -382,8 +435,15 @@
var highScore = storage.highScore || 0;
var atomicBomb = null;
var bombTimer = 0;
var hasBomb = false;
+var chocolate = null;
+var chocolateTimer = 0;
+var swanNormalTarget = {
+ x: 0,
+ y: 0
+};
+var swanTargetingChocolate = false;
// Initialize the game UI
var scoreTxt = new Text2('0', {
size: 80,
fill: 0xFFFFFF
@@ -480,10 +540,36 @@
if (!gameActive) return;
// Update game entities
goose.update();
swan.update();
- // Set swan target to goose position
- swan.setTarget(goose.x, goose.y);
+ if (chocolate) {
+ chocolate.update();
+ }
+ // Chocolate spawn logic
+ chocolateTimer++;
+ if (!chocolate && chocolateTimer > 480 && Math.random() < 0.008) {
+ chocolate = new Chocolate();
+ var angle = Math.random() * Math.PI * 2;
+ var distance = Math.random() * 600 + 150;
+ chocolate.x = pond.x + Math.cos(angle) * distance;
+ chocolate.y = pond.y + Math.sin(angle) * distance;
+ game.addChild(chocolate);
+ chocolateTimer = 0;
+ // Store goose position as normal target
+ swanNormalTarget = {
+ x: goose.x,
+ y: goose.y
+ };
+ // Make swan target chocolate
+ swanTargetingChocolate = true;
+ }
+ // Set swan target based on chocolate presence
+ if (swanTargetingChocolate && chocolate && !chocolate.isConsumed) {
+ swan.setTarget(chocolate.x, chocolate.y);
+ } else {
+ swan.setTarget(goose.x, goose.y);
+ swanTargetingChocolate = false;
+ }
// Atomic bomb spawn logic
bombTimer++;
if (!atomicBomb && !hasBomb && bombTimer > 600 && Math.random() < 0.005) {
atomicBomb = new AtomicBomb();
@@ -554,8 +640,22 @@
gameActive = false;
LK.showGameOver();
}
}
+ // Check for swan consuming chocolate
+ if (chocolate && !chocolate.isConsumed && swan.intersects(chocolate)) {
+ if (chocolate.consume()) {
+ // Swan gets distracted by chocolate
+ swan.stun(120); // Stun for 2 seconds (120 frames)
+ swan.aggressionLevel = Math.max(1, swan.aggressionLevel - 1); // Reduce aggression
+ // Play eating sound
+ LK.getSound('eat').play();
+ // Reset chocolate
+ chocolate = null;
+ chocolateTimer = 0;
+ swanTargetingChocolate = false;
+ }
+ }
// Check for atomic bomb collection
if (atomicBomb && !hasBomb && goose.intersects(atomicBomb) && atomicBomb.collect()) {
hasBomb = true;
atomicBomb.visible = false;
Modern App Store icon, high definition, square with rounded corners, for a game titled "Goose Chase: Battle for Chips" and with the description "Control a hungry goose collecting chips while battling an aggressive swan. Dodge attacks, counter with wing slaps and beak jabs, and collect as many chips as possible before the swan's fury becomes overwhelming. A hilarious battle of birds ensues as you try to satisfy your goose's appetite!". No text on icon!
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
A fuming swan with 16 cigarettes. In-Game asset. 2d. High contrast. No shadows
chocolate goose goose suren whatever smoke 4444444. In-Game asset. 2d. High contrast. No shadows