User prompt
Make it so that the image "background" is in the background
User prompt
make it so that the max points is 500 to win, and you have 5 lives
User prompt
now make it so that the sound "background" plays until the end then restarts infinitly
User prompt
make it go just a little bit higher
User prompt
make the shapes go higher
User prompt
the images wont show up. Also pls add a life system. you have 3 lives. if you miss the memes 3 times you get a game over
User prompt
pls do it again,
User prompt
I'm going to add a few more images, then you can add them to the assets looks!
User prompt
Fruit Ninja for sure, only let's make it a Meme Ninja where you slice meme images. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Restart everything, please.
User prompt
Initial prompt
Hi Ava!
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var MemeObject = Container.expand(function () { var self = Container.call(this); // Array of meme asset IDs var memeAssets = ['meme1', 'meme2', 'meme3', 'meme4']; var randomMeme = memeAssets[Math.floor(Math.random() * memeAssets.length)]; var memeGraphics = self.attachAsset(randomMeme, { anchorX: 0.5, anchorY: 0.5 }); self.isSliced = false; self.velocityX = (Math.random() - 0.5) * 200; // Random horizontal velocity self.velocityY = Math.random() * 300 + 200; // Upward velocity self.gravity = 800; // Gravity pulling down self.rotationSpeed = (Math.random() - 0.5) * 0.1; // Random rotation self.update = function () { if (!self.isSliced) { // Apply physics self.velocityY += self.gravity * (1 / 60); // Assuming 60 FPS self.x += self.velocityX * (1 / 60); self.y += self.velocityY * (1 / 60); self.rotation += self.rotationSpeed; } }; self.slice = function () { if (!self.isSliced) { self.isSliced = true; LK.getSound('slice').play(); // Create slice effect - split into two pieces var leftPiece = self.attachAsset(randomMeme, { anchorX: 0.5, anchorY: 0.5, x: -50, alpha: 0.8 }); var rightPiece = self.attachAsset(randomMeme, { anchorX: 0.5, anchorY: 0.5, x: 50, alpha: 0.8 }); // Hide original memeGraphics.visible = false; // Animate pieces falling apart tween(leftPiece, { x: -200, y: 200, rotation: -1, alpha: 0 }, { duration: 1000, easing: tween.easeIn }); tween(rightPiece, { x: 200, y: 200, rotation: 1, alpha: 0 }, { duration: 1000, easing: tween.easeIn }); // Score increase LK.setScore(LK.getScore() + 10); scoreTxt.setText(LK.getScore()); } }; return self; }); var SliceTrail = Container.expand(function () { var self = Container.call(this); var trailGraphics = self.attachAsset('slice_trail', { anchorX: 0.5, anchorY: 0.5, alpha: 0.8 }); self.fadeOut = function () { tween(self, { alpha: 0, scaleX: 0.5, scaleY: 0.5 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { self.destroy(); } }); }; return self; }); /**** * Initialize Game ****/ // Game variables // Assets will be defined here as needed var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ // Game variables // Initialize meme image assets and game elements var memes = []; var sliceTrails = []; var isSlicing = false; var lastSliceX = 0; var lastSliceY = 0; var lives = 5; // Add background image var backgroundImage = LK.getAsset('Background', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2, scaleX: 20.48, scaleY: 27.32 }); game.addChild(backgroundImage); // Set up score display var scoreTxt = new Text2('0', { size: 100, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); scoreTxt.y = 80; // Move down from very top // Set up lives display var livesTxt = new Text2('Lives: 5', { size: 80, fill: 0xFF0000 }); livesTxt.anchor.set(1, 0); LK.gui.topRight.addChild(livesTxt); livesTxt.x = -20; // Move away from right edge livesTxt.y = 80; // Spawn memes periodically var spawnTimer = LK.setInterval(function () { var newMeme = new MemeObject(); newMeme.x = Math.random() * (2048 - 400) + 200; // Random X position newMeme.y = 2732 + 100; // Start below screen newMeme.velocityY = -(Math.random() * 700 + 1100); // Much stronger upward velocity memes.push(newMeme); game.addChild(newMeme); }, 1500); // Spawn every 1.5 seconds // Handle slicing input game.down = function (x, y, obj) { isSlicing = true; lastSliceX = x; lastSliceY = y; }; // Play background music with infinite looping LK.playMusic('BackgroundMusic'); game.move = function (x, y, obj) { if (isSlicing) { // Create slice trail var trail = new SliceTrail(); trail.x = x; trail.y = y; sliceTrails.push(trail); game.addChild(trail); trail.fadeOut(); // Check for meme hits along the slice line for (var i = 0; i < memes.length; i++) { var meme = memes[i]; if (!meme.isSliced) { var dx = x - meme.x; var dy = y - meme.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < 120) { // Hit radius meme.slice(); } } } lastSliceX = x; lastSliceY = y; } }; game.up = function (x, y, obj) { isSlicing = false; }; // Main game loop game.update = function () { // Update all memes for (var i = memes.length - 1; i >= 0; i--) { var meme = memes[i]; // Remove memes that are off screen if (meme.y > 2732 + 200 || meme.isSliced && meme.y > 2732 + 400) { if (!meme.isSliced) { // Missed meme - play miss sound and lose life LK.getSound('miss').play(); lives--; livesTxt.setText('Lives: ' + lives); if (lives <= 0) { LK.showGameOver(); } } meme.destroy(); memes.splice(i, 1); } } // Clean up old slice trails for (var j = sliceTrails.length - 1; j >= 0; j--) { var trail = sliceTrails[j]; if (trail.alpha <= 0) { sliceTrails.splice(j, 1); } } // Win condition if (LK.getScore() >= 500) { LK.showYouWin(); } };
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var MemeObject = Container.expand(function () {
var self = Container.call(this);
// Array of meme asset IDs
var memeAssets = ['meme1', 'meme2', 'meme3', 'meme4'];
var randomMeme = memeAssets[Math.floor(Math.random() * memeAssets.length)];
var memeGraphics = self.attachAsset(randomMeme, {
anchorX: 0.5,
anchorY: 0.5
});
self.isSliced = false;
self.velocityX = (Math.random() - 0.5) * 200; // Random horizontal velocity
self.velocityY = Math.random() * 300 + 200; // Upward velocity
self.gravity = 800; // Gravity pulling down
self.rotationSpeed = (Math.random() - 0.5) * 0.1; // Random rotation
self.update = function () {
if (!self.isSliced) {
// Apply physics
self.velocityY += self.gravity * (1 / 60); // Assuming 60 FPS
self.x += self.velocityX * (1 / 60);
self.y += self.velocityY * (1 / 60);
self.rotation += self.rotationSpeed;
}
};
self.slice = function () {
if (!self.isSliced) {
self.isSliced = true;
LK.getSound('slice').play();
// Create slice effect - split into two pieces
var leftPiece = self.attachAsset(randomMeme, {
anchorX: 0.5,
anchorY: 0.5,
x: -50,
alpha: 0.8
});
var rightPiece = self.attachAsset(randomMeme, {
anchorX: 0.5,
anchorY: 0.5,
x: 50,
alpha: 0.8
});
// Hide original
memeGraphics.visible = false;
// Animate pieces falling apart
tween(leftPiece, {
x: -200,
y: 200,
rotation: -1,
alpha: 0
}, {
duration: 1000,
easing: tween.easeIn
});
tween(rightPiece, {
x: 200,
y: 200,
rotation: 1,
alpha: 0
}, {
duration: 1000,
easing: tween.easeIn
});
// Score increase
LK.setScore(LK.getScore() + 10);
scoreTxt.setText(LK.getScore());
}
};
return self;
});
var SliceTrail = Container.expand(function () {
var self = Container.call(this);
var trailGraphics = self.attachAsset('slice_trail', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.8
});
self.fadeOut = function () {
tween(self, {
alpha: 0,
scaleX: 0.5,
scaleY: 0.5
}, {
duration: 200,
easing: tween.easeOut,
onFinish: function onFinish() {
self.destroy();
}
});
};
return self;
});
/****
* Initialize Game
****/
// Game variables
// Assets will be defined here as needed
var game = new LK.Game({
backgroundColor: 0x000000
});
/****
* Game Code
****/
// Game variables
// Initialize meme image assets and game elements
var memes = [];
var sliceTrails = [];
var isSlicing = false;
var lastSliceX = 0;
var lastSliceY = 0;
var lives = 5;
// Add background image
var backgroundImage = LK.getAsset('Background', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 / 2,
scaleX: 20.48,
scaleY: 27.32
});
game.addChild(backgroundImage);
// Set up score display
var scoreTxt = new Text2('0', {
size: 100,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
scoreTxt.y = 80; // Move down from very top
// Set up lives display
var livesTxt = new Text2('Lives: 5', {
size: 80,
fill: 0xFF0000
});
livesTxt.anchor.set(1, 0);
LK.gui.topRight.addChild(livesTxt);
livesTxt.x = -20; // Move away from right edge
livesTxt.y = 80;
// Spawn memes periodically
var spawnTimer = LK.setInterval(function () {
var newMeme = new MemeObject();
newMeme.x = Math.random() * (2048 - 400) + 200; // Random X position
newMeme.y = 2732 + 100; // Start below screen
newMeme.velocityY = -(Math.random() * 700 + 1100); // Much stronger upward velocity
memes.push(newMeme);
game.addChild(newMeme);
}, 1500); // Spawn every 1.5 seconds
// Handle slicing input
game.down = function (x, y, obj) {
isSlicing = true;
lastSliceX = x;
lastSliceY = y;
};
// Play background music with infinite looping
LK.playMusic('BackgroundMusic');
game.move = function (x, y, obj) {
if (isSlicing) {
// Create slice trail
var trail = new SliceTrail();
trail.x = x;
trail.y = y;
sliceTrails.push(trail);
game.addChild(trail);
trail.fadeOut();
// Check for meme hits along the slice line
for (var i = 0; i < memes.length; i++) {
var meme = memes[i];
if (!meme.isSliced) {
var dx = x - meme.x;
var dy = y - meme.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance < 120) {
// Hit radius
meme.slice();
}
}
}
lastSliceX = x;
lastSliceY = y;
}
};
game.up = function (x, y, obj) {
isSlicing = false;
};
// Main game loop
game.update = function () {
// Update all memes
for (var i = memes.length - 1; i >= 0; i--) {
var meme = memes[i];
// Remove memes that are off screen
if (meme.y > 2732 + 200 || meme.isSliced && meme.y > 2732 + 400) {
if (!meme.isSliced) {
// Missed meme - play miss sound and lose life
LK.getSound('miss').play();
lives--;
livesTxt.setText('Lives: ' + lives);
if (lives <= 0) {
LK.showGameOver();
}
}
meme.destroy();
memes.splice(i, 1);
}
}
// Clean up old slice trails
for (var j = sliceTrails.length - 1; j >= 0; j--) {
var trail = sliceTrails[j];
if (trail.alpha <= 0) {
sliceTrails.splice(j, 1);
}
}
// Win condition
if (LK.getScore() >= 500) {
LK.showYouWin();
}
};