User prompt
add more to be 20 memes and name it 'meme1'...'meme2'...etc for their buttons 'meme1button'
Code edit (1 edits merged)
Please save this source code
User prompt
Meme Face Match
Initial prompt
Its about memes faces many buttons of faces memes on the bottom of screen and the memes faces will respawning from the top of screen you have to click the button of the respawning face to explode it and get score.
/**** * Classes ****/ // Sound for when a meme reaches the bottom // No plugins needed for this version. // Class for the falling meme faces var FallingMeme = Container.expand(function (memeType, speed) { var self = Container.call(this); self.memeType = memeType; // Store the type (e.g., 'meme1', 'meme5') self.speed = speed; // Attach the corresponding meme image asset var memeGraphics = self.attachAsset(memeType, { anchorX: 0.5, anchorY: 0.5 }); self.assetWidth = memeGraphics.width; // Store dimensions for easier access self.assetHeight = memeGraphics.height; // Update function called by LK engine each frame self.update = function () { self.y += self.speed; }; // Method to check if the meme is off the bottom of the screen self.isOffScreen = function (gameHeight) { // Consider the meme off-screen if its top edge is past the bottom return self.y - self.assetHeight / 2 > gameHeight; }; return self; }); // Class for the buttons at the bottom var MemeButton = Container.expand(function (memeType) { var self = Container.call(this); self.memeType = memeType; // Store the type (e.g., 'meme1', 'meme5') // Attach the corresponding meme image asset var buttonGraphics = self.attachAsset(memeType, { anchorX: 0.5, anchorY: 0.5, scaleX: 0.8, // Make buttons slightly smaller than falling memes scaleY: 0.8 }); // Store dimensions for layout self.assetWidth = buttonGraphics.width * 0.8; self.assetHeight = buttonGraphics.height * 0.8; // Event handler for when the button is pressed // This will be automatically called by the LK engine if the button is attached self.down = function (x, y, obj) { // Find the lowest falling meme of the matching type var matchedMeme = null; var lowestY = -1; for (var i = 0; i < fallingMemes.length; i++) { var meme = fallingMemes[i]; if (meme.memeType === self.memeType && meme.y > lowestY) { lowestY = meme.y; matchedMeme = meme; } } // If a match was found if (matchedMeme) { // Remove the matched meme from the array and destroy it var index = fallingMemes.indexOf(matchedMeme); if (index > -1) { fallingMemes.splice(index, 1); } matchedMeme.destroy(); // Destroy the game object // Increase score and update display LK.setScore(LK.getScore() + 1); scoreTxt.setText(LK.getScore()); // Play match sound LK.getSound('matchSound').play(); // Optional: Add a visual feedback like flashing the button LK.effects.flashObject(self, 0x00FF00, 200); // Flash green briefly } else { // Optional: Handle incorrect tap (e.g., small screen flash red, sound) // LK.effects.flashScreen(0xFF0000, 100); // LK.getSound('missSound').play(); // Potentially confusing with game over sound } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x111111 // Dark grey background }); /**** * Game Code ****/ // LightGreen // LightBlue // PeachPuff // Lavender // Khaki // Gray // Silver // Teal // Olive // Navy // Maroon // Green // Purple // Orange // Cyan // Magenta // Yellow // Blue // Lime // Red // Define 20 meme assets with placeholder shapes and colors // Assuming square meme images. Adjust width/height if needed. // Initialize assets used in this game. Engine will automatically create if not present. // Game constants and variables var GAME_WIDTH = 2048; var GAME_HEIGHT = 2732; var MEME_TYPES = ['meme1', 'meme2', 'meme3', 'meme4', 'meme5', 'meme6', 'meme7', 'meme8', 'meme9', 'meme10', 'meme11', 'meme12', 'meme13', 'meme14', 'meme15', 'meme16', 'meme17', 'meme18', 'meme19', 'meme20']; var INITIAL_SPEED = 5; var SPAWN_INTERVAL_TICKS = 90; // How often to spawn a new meme (90 ticks = 1.5 seconds at 60fps) var fallingMemes = []; // Array to hold active FallingMeme instances var scoreTxt; var gameSpeed = INITIAL_SPEED; var spawnCounter = 0; // --- Score Display --- scoreTxt = new Text2('0', { size: 120, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); // Anchor top-center // Position score text at the top-center using LK.gui LK.gui.top.addChild(scoreTxt); // Offset slightly down to avoid interfering with potential top-bar elements scoreTxt.y = 20; // --- Meme Buttons --- var buttons = []; var totalButtonWidth = 0; var buttonPadding = 20; // Reduced space between buttons to fit 20 // Create buttons for (var i = 0; i < MEME_TYPES.length; i++) { var memeType = MEME_TYPES[i]; var button = new MemeButton(memeType); buttons.push(button); // Temporarily add to calculate total width (using assetWidth stored in button class) if (i > 0) { totalButtonWidth += buttonPadding; } totalButtonWidth += button.assetWidth; } // Calculate starting X position for the first button to center the group var startX = (GAME_WIDTH - totalButtonWidth) / 2; var currentX = startX; var buttonY = GAME_HEIGHT - 150; // Position buttons near the bottom // Position and add buttons to the game stage for (var i = 0; i < buttons.length; i++) { var button = buttons[i]; button.x = currentX + button.assetWidth / 2; // Position based on center anchor button.y = buttonY; game.addChild(button); currentX += button.assetWidth + buttonPadding; } // --- Game Update Logic --- game.update = function () { spawnCounter++; // Spawn new memes periodically if (spawnCounter >= SPAWN_INTERVAL_TICKS) { spawnCounter = 0; // Select a random meme type var randomIndex = Math.floor(Math.random() * MEME_TYPES.length); var newMemeType = MEME_TYPES[randomIndex]; // Create a new falling meme instance var newMeme = new FallingMeme(newMemeType, gameSpeed); // Position it randomly across the top, avoiding edges slightly var assetWidth = newMeme.assetWidth; // Get width from the instance newMeme.x = Math.random() * (GAME_WIDTH - assetWidth) + assetWidth / 2; newMeme.y = -newMeme.assetHeight / 2; // Start just above the screen // Initialize last state tracking newMeme.lastY = newMeme.y; // Add to game stage and tracking array game.addChild(newMeme); fallingMemes.push(newMeme); // Gradually increase difficulty (optional) // gameSpeed += 0.05; // SPAWN_INTERVAL_TICKS = Math.max(30, SPAWN_INTERVAL_TICKS * 0.995); // Decrease spawn interval slowly } // Update and check existing falling memes for (var i = fallingMemes.length - 1; i >= 0; i--) { var meme = fallingMemes[i]; // Update last position before moving if (meme.lastY === undefined) { meme.lastY = meme.y; } // Initialize if needed // Check if meme reached the bottom (transition detection) // Check if the bottom edge of the meme crosses the button line var bottomEdge = meme.y + meme.assetHeight / 2; var lastBottomEdge = meme.lastY + meme.assetHeight / 2; var boundaryY = buttonY - buttons[0].assetHeight / 2 - 20; // Line slightly above buttons if (lastBottomEdge <= boundaryY && bottomEdge > boundaryY) { // Meme crossed the line - Game Over LK.getSound('missSound').play(); // Play miss sound LK.showGameOver(); // Trigger game over handled by LK engine // Important: showGameOver stops further execution of this game instance return; // Exit update loop as game is ending } // If it somehow got way past the screen (cleanup, although game over should trigger first) if (meme.isOffScreen(GAME_HEIGHT + 100)) { // This case should ideally not be reached due to game over check above meme.destroy(); fallingMemes.splice(i, 1); } // Update last known states meme.lastY = meme.y; } }; // Note: No need for game.down, game.up, game.move handlers for this specific game mechanic. // Button presses are handled by the MemeButton class's down method.
===================================================================
--- original.js
+++ change.js
@@ -5,9 +5,9 @@
// No plugins needed for this version.
// Class for the falling meme faces
var FallingMeme = Container.expand(function (memeType, speed) {
var self = Container.call(this);
- self.memeType = memeType; // Store the type ('troll', 'doge', 'grumpy')
+ self.memeType = memeType; // Store the type (e.g., 'meme1', 'meme5')
self.speed = speed;
// Attach the corresponding meme image asset
var memeGraphics = self.attachAsset(memeType, {
anchorX: 0.5,
@@ -28,9 +28,9 @@
});
// Class for the buttons at the bottom
var MemeButton = Container.expand(function (memeType) {
var self = Container.call(this);
- self.memeType = memeType; // Store the type ('troll', 'doge', 'grumpy')
+ self.memeType = memeType; // Store the type (e.g., 'meme1', 'meme5')
// Attach the corresponding meme image asset
var buttonGraphics = self.attachAsset(memeType, {
anchorX: 0.5,
anchorY: 0.5,
@@ -87,14 +87,35 @@
/****
* Game Code
****/
+// LightGreen
+// LightBlue
+// PeachPuff
+// Lavender
+// Khaki
+// Gray
+// Silver
+// Teal
+// Olive
+// Navy
+// Maroon
+// Green
+// Purple
+// Orange
+// Cyan
+// Magenta
+// Yellow
+// Blue
+// Lime
+// Red
+// Define 20 meme assets with placeholder shapes and colors
// Assuming square meme images. Adjust width/height if needed.
// Initialize assets used in this game. Engine will automatically create if not present.
// Game constants and variables
var GAME_WIDTH = 2048;
var GAME_HEIGHT = 2732;
-var MEME_TYPES = ['troll', 'doge', 'grumpy'];
+var MEME_TYPES = ['meme1', 'meme2', 'meme3', 'meme4', 'meme5', 'meme6', 'meme7', 'meme8', 'meme9', 'meme10', 'meme11', 'meme12', 'meme13', 'meme14', 'meme15', 'meme16', 'meme17', 'meme18', 'meme19', 'meme20'];
var INITIAL_SPEED = 5;
var SPAWN_INTERVAL_TICKS = 90; // How often to spawn a new meme (90 ticks = 1.5 seconds at 60fps)
var fallingMemes = []; // Array to hold active FallingMeme instances
var scoreTxt;
@@ -112,9 +133,9 @@
scoreTxt.y = 20;
// --- Meme Buttons ---
var buttons = [];
var totalButtonWidth = 0;
-var buttonPadding = 50; // Space between buttons
+var buttonPadding = 20; // Reduced space between buttons to fit 20
// Create buttons
for (var i = 0; i < MEME_TYPES.length; i++) {
var memeType = MEME_TYPES[i];
var button = new MemeButton(memeType);
Same face in the image but 3D
3D Scary trollface meme. In-Game asset. 3D. High contrast. No shadows
3D jeff the killer Scary face meme. In-Game asset. 3D. High contrast. No shadows
3D Scary face meme "Terrifier3" from the movie, face only In-Game asset. 3D. High contrast. No shadows. face only
3D Scary but funny annabelle doll face meme. In-Game asset. 3D. High contrast. No shadows
3D Scary face meme samara have green face. only face. normal eyes no so opened. smile In-Game asset. High contrast. 3D. No shadows. only face
3D Scary room with many 3D decorations around, 3D scary masks of memes around it. In-Game asset. 3D. High contrast. No shadows. no jesus cross. no star of 6. no start of 5. no devil. HD colors
3D Scary but funny meme face of momo. face only. different faces look In-Game asset. 3d. High contrast. No shadows
Gamemusic1
Music
meme1matchsound1
Sound effect
meme2matchsound1
Sound effect
meme3matchsound1
Sound effect
meme4matchsound1
Sound effect
meme5matchsound1
Sound effect
meme6matchsound1
Sound effect
meme7matchsound1
Sound effect
meme8matchsound1
Sound effect
meme9matchsound1
Sound effect
meme10matchsound1
Sound effect
meme11matchsound1
Sound effect
meme12matchsound1
Sound effect
meme13matchsound1
Sound effect
meme14matchsound1
Sound effect
meme15matchsound1
Sound effect
meme16matchsound1
Sound effect
meme17matchsound1
Sound effect
meme18matchsound1
Sound effect
meme19matchsound1
Sound effect
meme20matchsound1
Sound effect
missSound
Sound effect