User prompt
Make toys only give 5 score and doing something wrong removes 15 points and prevent points from going into negatives
User prompt
Make the “Wrong” sound not play on game over
User prompt
The santa makes clones of itself it is buggy ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make the santa almost be as big as the entire screen ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make the delay before gameover 2 seconds because the sound is longer than 1 second
User prompt
Make a sound that plays when the santa appears
User prompt
Before the game over screen, santa should appear on your screen for 1 seconds ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Add brown toys which start spawning after you played for 25 seconds and because there is no brown box if you put the brown toy into a box it will result in 1 wrong
User prompt
Replace health: Health with Wrong: Wrong/3
Code edit (1 edits merged)
Please save this source code
User prompt
Christmas Boxing Bonanza
Initial prompt
Christmas themed fast paced boxing game: Only put red toys in red boxes, yellow toys in yellow boxes and blue toys in blue boxes
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Box = Container.expand(function (color) { var self = Container.call(this); self.color = color; var assetName = color + 'Box'; var boxGraphics = self.attachAsset(assetName, { anchorX: 0.5, anchorY: 0.5 }); return self; }); var Toy = Container.expand(function (color) { var self = Container.call(this); self.color = color; self.speed = 3; self.isDragging = false; self.startX = 0; self.startY = 0; var assetName = color + 'Toy'; var toyGraphics = self.attachAsset(assetName, { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { if (!self.isDragging) { self.y += self.speed; } }; self.down = function (x, y, obj) { self.isDragging = true; self.startX = self.x; self.startY = self.y; draggedToy = self; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x006600 }); /**** * Game Code ****/ // Game variables var toys = []; var boxes = []; var draggedToy = null; var wrong = 0; var spawnTimer = 0; var spawnDelay = 90; var gameSpeed = 1; var speedIncreaseTimer = 0; // Create boxes at bottom of screen var boxColors = ['red', 'yellow', 'blue']; var boxPositions = [2048 / 4, 2048 / 2, 3 * 2048 / 4]; for (var i = 0; i < boxColors.length; i++) { var box = new Box(boxColors[i]); box.x = boxPositions[i]; box.y = 2732 - 200; boxes.push(box); game.addChild(box); } // UI Elements var scoreTxt = new Text2('Score: 0', { size: 80, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); var healthTxt = new Text2('Wrong: 0/3', { size: 80, fill: 0xFF0000 }); healthTxt.anchor.set(0, 0); healthTxt.x = 150; healthTxt.y = 20; LK.gui.topLeft.addChild(healthTxt); // Spawn toy function function spawnToy() { var randomColor = boxColors[Math.floor(Math.random() * boxColors.length)]; var toy = new Toy(randomColor); toy.x = Math.random() * (2048 - 240) + 120; toy.y = -60; toy.speed = 3 * gameSpeed; toys.push(toy); game.addChild(toy); } // Check if toy intersects with any box function checkToyBoxIntersection(toy) { for (var i = 0; i < boxes.length; i++) { if (toy.intersects(boxes[i])) { return boxes[i]; } } return null; } // Remove toy from game function removeToy(toy, index) { toy.destroy(); toys.splice(index, 1); } // Game input handlers game.move = function (x, y, obj) { if (draggedToy) { draggedToy.x = x; draggedToy.y = y; } }; game.up = function (x, y, obj) { if (draggedToy) { var intersectingBox = checkToyBoxIntersection(draggedToy); if (intersectingBox) { if (draggedToy.color === intersectingBox.color) { // Correct placement LK.setScore(LK.getScore() + 10); scoreTxt.setText('Score: ' + LK.getScore()); LK.getSound('correct').play(); // Remove toy var toyIndex = toys.indexOf(draggedToy); if (toyIndex !== -1) { removeToy(draggedToy, toyIndex); } } else { // Wrong placement wrong++; healthTxt.setText('Wrong: ' + wrong + '/3'); LK.getSound('wrong').play(); LK.effects.flashScreen(0xff0000, 500); // Return toy to original position draggedToy.x = draggedToy.startX; draggedToy.y = draggedToy.startY; } } else { // Return toy to original position if not dropped on box draggedToy.x = draggedToy.startX; draggedToy.y = draggedToy.startY; } draggedToy.isDragging = false; draggedToy = null; } }; // Main game update game.update = function () { // Spawn toys spawnTimer++; if (spawnTimer >= spawnDelay) { spawnToy(); spawnTimer = 0; } // Increase game speed over time speedIncreaseTimer++; if (speedIncreaseTimer >= 600) { // Every 10 seconds at 60fps gameSpeed += 0.1; if (spawnDelay > 30) { spawnDelay -= 2; } speedIncreaseTimer = 0; } // Update toys and check for collisions/missed toys for (var i = toys.length - 1; i >= 0; i--) { var toy = toys[i]; // Check if toy fell off screen if (toy.y > 2732 + 60) { wrong++; healthTxt.setText('Wrong: ' + wrong + '/3'); LK.effects.flashScreen(0xff0000, 300); removeToy(toy, i); continue; } // Check if toy is intersecting with correct box while not being dragged if (!toy.isDragging) { var intersectingBox = checkToyBoxIntersection(toy); if (intersectingBox && toy.color === intersectingBox.color) { LK.setScore(LK.getScore() + 10); scoreTxt.setText('Score: ' + LK.getScore()); LK.getSound('correct').play(); removeToy(toy, i); continue; } } } // Check game over condition if (wrong >= 3) { LK.showGameOver(); } // Check win condition (optional - high score) if (LK.getScore() >= 500) { LK.showYouWin(); } }; // Start background music LK.playMusic('christmas');
===================================================================
--- original.js
+++ change.js
@@ -55,9 +55,9 @@
// Game variables
var toys = [];
var boxes = [];
var draggedToy = null;
-var health = 3;
+var wrong = 0;
var spawnTimer = 0;
var spawnDelay = 90;
var gameSpeed = 1;
var speedIncreaseTimer = 0;
@@ -77,9 +77,9 @@
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
-var healthTxt = new Text2('Health: 3', {
+var healthTxt = new Text2('Wrong: 0/3', {
size: 80,
fill: 0xFF0000
});
healthTxt.anchor.set(0, 0);
@@ -132,10 +132,10 @@
removeToy(draggedToy, toyIndex);
}
} else {
// Wrong placement
- health--;
- healthTxt.setText('Health: ' + health);
+ wrong++;
+ healthTxt.setText('Wrong: ' + wrong + '/3');
LK.getSound('wrong').play();
LK.effects.flashScreen(0xff0000, 500);
// Return toy to original position
draggedToy.x = draggedToy.startX;
@@ -172,10 +172,10 @@
for (var i = toys.length - 1; i >= 0; i--) {
var toy = toys[i];
// Check if toy fell off screen
if (toy.y > 2732 + 60) {
- health--;
- healthTxt.setText('Health: ' + health);
+ wrong++;
+ healthTxt.setText('Wrong: ' + wrong + '/3');
LK.effects.flashScreen(0xff0000, 300);
removeToy(toy, i);
continue;
}
@@ -191,9 +191,9 @@
}
}
}
// Check game over condition
- if (health <= 0) {
+ if (wrong >= 3) {
LK.showGameOver();
}
// Check win condition (optional - high score)
if (LK.getScore() >= 500) {
Santa angry In-Game asset. 2d. High contrast. No shadows
Brown rocking horse. In-Game asset. 2d. High contrast. No shadows
Brown kids book. In-Game asset. 2d. High contrast. No shadows
A blue robot toy. In-Game asset. 2d. High contrast. No shadows
A yellow box. In-Game asset. 2d. High contrast. No shadows
Yellow star plushie with a smile on it. In-Game asset. 2d. High contrast. No shadows
A red toy car. In-Game asset. 2d. High contrast. No shadows
A yellow banana. In-Game asset. 2d. High contrast. No shadows
Red ball with two white eyes, inside the eyes are medium sized black dots, and a black smiley mouth. In-Game asset. 2d. High contrast. No shadows
Blue diamond toy. In-Game asset. 2d. High contrast
Red exclamation mark with a gradient and a stroke. In-Game asset. 2d. High contrast. No shadows
Green box. In-Game asset. 2d. High contrast. No shadows
Red clock. In-Game asset. 2d. High contrast. No shadows
A green puzzle piece. In-Game asset. 2d. High contrast. No shadows
Green dino plushie. In-Game asset. 2d. High contrast. No shadows
Green apple. In-Game asset. 2d. High contrast. No shadows