User prompt
piano muĢzigĢini oyun muĢzigĢi olarak kullan ekle
User prompt
sıralamyo dogĢru bildigĢinde yes ses efektini yanlış bildigĢinde zort ses efektini kullan
User prompt
yazılar daha modern olsun ve kalın olsun goĢruĢnuĢr şekilde sayılarda aynı şekilde
User prompt
arka planı kullan
User prompt
tamam guĢzel şimdi melodilerin notaların ara mesafesini aç ve braz buĢyuĢt birde her nota melodi için bir ses efekti ekle hepsinin bir notası olacak do re mi gibi
User prompt
hangi melodiye tıklayacagĢımızı goĢsterceksin ama başta sana dedimya goĢrsel hafıza
User prompt
o resimler kaobolmuyacak resimler bizim tıklayacagĢımız yer aynı resimlerden uĢstte olacak yanıp soĢnecek klasik goĢrsel hafıza oyunu
User prompt
şimdi oyunda meldoi resimleri goĢruĢnecek ve hafza mantıgĢı bir oyun goĢstercek kapanacak dogĢru tıklayın 2. boĢluĢm olacak oĢyle zorlugĢu artacak yanana kadar sonsuz puanla devam edecek
User prompt
verdigĢim melodi resimlerini kullan
Code edit (1 edits merged)
Please save this source code
User prompt
Color Path Memory
Initial prompt
https://upit.com/@eren_25/play/yer_VUCAde şu oyunun aynısını yap
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
// Tile class: represents a melody image tile in the grid
var Tile = Container.expand(function () {
var self = Container.call(this);
// Properties
self.tileIndex = -1; // index in the tiles array
// Attach asset (melody image based on index)
var melodyIds = ['melodi1', 'melodi2', 'melodi3', 'melodi4'];
var tileAsset = self.attachAsset(melodyIds[self.tileIndex >= 0 ? self.tileIndex : 0], {
anchorX: 0.5,
anchorY: 0.5
});
// Set image (for initialization, called after tileIndex is set)
self.setImage = function (idx) {
// Remove old asset if exists
if (tileAsset && tileAsset.parent) {
tileAsset.parent.removeChild(tileAsset);
}
var melodyId = melodyIds[idx];
var newAsset = self.attachAsset(melodyId, {
anchorX: 0.5,
anchorY: 0.5
});
// Set size to TILE_SIZE
newAsset.width = TILE_SIZE;
newAsset.height = TILE_SIZE;
// Save reference
tileAsset = newAsset;
};
// Flash animation for showing sequence or feedback
self.flash = function (duration, highlightColor, _onFinish) {
// Animate alpha to 0.5, then back to 1 for feedback
tween(tileAsset, {
alpha: 0.5
}, {
duration: duration / 2,
easing: tween.easeIn,
onFinish: function onFinish() {
tween(tileAsset, {
alpha: 1
}, {
duration: duration / 2,
easing: tween.easeOut,
onFinish: _onFinish
});
}
});
};
// Down event: called when player taps this tile
self.down = function (x, y, obj) {
if (game.inputEnabled) {
game.handleTileTap(self.tileIndex);
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x222222
});
/****
* Game Code
****/
// --- CONFIGURATION ---
var GRID_SIZE = 2; // 2x2 grid (classic Simon style)
var TILE_GAP = 60; // px gap between tiles
var TILE_SIZE = 400; // px, will be scaled for iPad Pro
var TILE_COLORS = [0xff3b30, 0x34c759, 0x007aff, 0xffcc00]; // red, green, blue, yellow
var TILE_HIGHLIGHT = [0xff8880, 0x88ffb0, 0x80b0ff, 0xfff680]; // lighter highlight for each color
var SEQUENCE_START_LENGTH = 3;
var SEQUENCE_GROWTH = 1;
var SEQUENCE_MAX_LENGTH = 100;
var SHOW_STEP_BASE_DURATION = 500; // ms, will get faster
var SHOW_STEP_MIN_DURATION = 200; // ms
var INPUT_TIME_LIMIT = 5000; // ms per sequence (decreases as level increases)
var TILE_FLASH_FEEDBACK = 250; // ms
// --- ASSETS ---
for (var i = 0; i < TILE_COLORS.length; i++) {}
// generic, color set later
// --- STATE ---
var tiles = []; // array of Tile instances
var sequence = []; // array of tile indices (the pattern to repeat)
var playerInput = []; // array of tile indices (player's taps)
var currentStep = 0; // which step in the sequence is being shown
var showingSequence = false;
var inputTimer = null;
var inputTimeLeft = 0;
var level = 1;
var inputEnabled = false;
var score = 0;
// --- UI ---
var scoreTxt = new Text2('0', {
size: 120,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
var levelTxt = new Text2('Level 1', {
size: 80,
fill: 0xCCCCCC
});
levelTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(levelTxt);
levelTxt.y = 130;
var timerTxt = new Text2('', {
size: 80,
fill: 0xFFCC00
});
timerTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(timerTxt);
timerTxt.y = 230;
var instructionTxt = new Text2('Watch the sequence!', {
size: 70,
fill: 0xFFFFFF
});
instructionTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(instructionTxt);
instructionTxt.y = 330;
// --- GAME LOGIC ---
// Helper: center grid on screen
function getTilePos(row, col) {
var gridW = GRID_SIZE * TILE_SIZE + (GRID_SIZE - 1) * TILE_GAP;
var gridH = GRID_SIZE * TILE_SIZE + (GRID_SIZE - 1) * TILE_GAP;
var startX = (2048 - gridW) / 2 + TILE_SIZE / 2;
var startY = (2732 - gridH) / 2 + TILE_SIZE / 2 + 100; // +100 to avoid top menu
return {
x: startX + col * (TILE_SIZE + TILE_GAP),
y: startY + row * (TILE_SIZE + TILE_GAP)
};
}
// Create grid of tiles
for (var row = 0; row < GRID_SIZE; row++) {
for (var col = 0; col < GRID_SIZE; col++) {
var idx = row * GRID_SIZE + col;
var tile = new Tile();
tile.tileIndex = idx;
tile.setImage(idx); // Set the melody image for this tile
var pos = getTilePos(row, col);
tile.x = pos.x;
tile.y = pos.y;
tiles.push(tile);
game.addChild(tile);
}
}
// --- GAME STATE MANAGEMENT ---
// Start a new game
function startGame() {
sequence = [];
playerInput = [];
currentStep = 0;
showingSequence = false;
level = 1;
score = 0;
inputEnabled = false;
updateScore();
updateLevel();
nextRound();
}
// Start next round (add to sequence, show it)
function nextRound() {
playerInput = [];
inputEnabled = false;
// Add new random tile to sequence
if (sequence.length < SEQUENCE_MAX_LENGTH) {
for (var i = 0; i < SEQUENCE_GROWTH; i++) {
var nextIdx = Math.floor(Math.random() * tiles.length);
sequence.push(nextIdx);
}
}
currentStep = 0;
showSequence();
}
// Show the sequence to the player
function showSequence() {
showingSequence = true;
inputEnabled = false;
instructionTxt.setText('Watch the sequence!');
var stepDuration = Math.max(SHOW_STEP_BASE_DURATION - (level - 1) * 30, SHOW_STEP_MIN_DURATION);
// Helper: show all tile images (always visible in this version)
function showAllTiles() {
for (var i = 0; i < tiles.length; i++) {
if (tiles[i].children.length > 0) {
tiles[i].children[0].visible = true;
}
}
}
// Always show all tiles before sequence
showAllTiles();
function showStep(step) {
if (step >= sequence.length) {
showingSequence = false;
// Do NOT hide tiles for memory challenge; keep them visible
enableInput();
return;
}
var idx = sequence[step];
// More pronounced visual feedback during sequence showing
var tile = tiles[idx];
// Scale up the tile to make it more obvious
tween(tile, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: stepDuration / 3,
easing: tween.easeOut,
onFinish: function onFinish() {
// Scale back down
tween(tile, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: stepDuration / 3,
easing: tween.easeIn,
onFinish: function onFinish() {
LK.setTimeout(function () {
showStep(step + 1);
}, 100);
}
});
}
});
// Also keep the flash effect
tiles[idx].flash(stepDuration, TILE_HIGHLIGHT[idx], function () {
// Flash completed
});
}
showStep(0);
}
// Enable player input
function enableInput() {
inputEnabled = true;
game.inputEnabled = true;
instructionTxt.setText('Repeat the sequence!');
inputTimeLeft = Math.max(INPUT_TIME_LIMIT - (level - 1) * 200, 2000);
updateTimerText();
if (inputTimer) {
LK.clearInterval(inputTimer);
}
inputTimer = LK.setInterval(function () {
inputTimeLeft -= 100;
updateTimerText();
if (inputTimeLeft <= 0) {
inputEnabled = false;
game.inputEnabled = false;
LK.clearInterval(inputTimer);
inputTimer = null;
failSequence();
}
}, 100);
}
// Handle player tapping a tile
game.handleTileTap = function (tileIdx) {
if (!inputEnabled || showingSequence) return;
playerInput.push(tileIdx);
// Flash feedback (no hiding/showing, just flash effect)
tiles[tileIdx].flash(TILE_FLASH_FEEDBACK, TILE_HIGHLIGHT[tileIdx], function () {
// No need to hide or show tile images; always visible
});
// Check correctness
var expected = sequence[playerInput.length - 1];
if (tileIdx !== expected) {
inputEnabled = false;
game.inputEnabled = false;
if (inputTimer) {
LK.clearInterval(inputTimer);
inputTimer = null;
}
// Flash red
LK.effects.flashScreen(0xff0000, 800);
LK.setTimeout(function () {
LK.showGameOver();
}, 800);
return;
}
// If correct and finished input
if (playerInput.length === sequence.length) {
if (inputTimer) {
LK.clearInterval(inputTimer);
inputTimer = null;
}
// Success! Increase score, level, and go to next round
score += sequence.length;
level += 1;
updateScore();
updateLevel();
// Flash green
LK.effects.flashScreen(0x00ff00, 400);
LK.setTimeout(function () {
nextRound();
}, 500);
}
};
// Player failed to input in time
function failSequence() {
inputEnabled = false;
game.inputEnabled = false;
// Flash red
LK.effects.flashScreen(0xff0000, 800);
LK.setTimeout(function () {
LK.showGameOver();
}, 800);
}
// Update score display
function updateScore() {
scoreTxt.setText(score);
LK.setScore(score);
}
// Update level display
function updateLevel() {
levelTxt.setText('Level ' + level);
}
// Update timer display
function updateTimerText() {
if (!inputEnabled) {
timerTxt.setText('');
return;
}
var sec = Math.ceil(inputTimeLeft / 100) / 10;
timerTxt.setText(sec.toFixed(1) + 's');
}
// --- GAME EVENT HOOKS ---
// On game reset, start new game
startGame();
// On game over, reset state (LK will call this automatically)
game.on('reset', function () {
startGame();
});
// --- DRAGGING DISABLED ---
// No dragging or move events needed for this game
// --- WIN CONDITION ---
// If player reaches max sequence length, show win
function checkWin() {
if (sequence.length >= SEQUENCE_MAX_LENGTH) {
LK.effects.flashScreen(0x00ff00, 1000);
LK.setTimeout(function () {
LK.showYouWin();
}, 1000);
}
}
// --- GAME UPDATE LOOP ---
game.update = function () {
// Nothing needed here for this game
// Timer is handled by inputTimer
// Could check for win
checkWin();
}; ===================================================================
--- original.js
+++ change.js
@@ -119,8 +119,15 @@
});
timerTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(timerTxt);
timerTxt.y = 230;
+var instructionTxt = new Text2('Watch the sequence!', {
+ size: 70,
+ fill: 0xFFFFFF
+});
+instructionTxt.anchor.set(0.5, 0);
+LK.gui.top.addChild(instructionTxt);
+instructionTxt.y = 330;
// --- GAME LOGIC ---
// Helper: center grid on screen
function getTilePos(row, col) {
var gridW = GRID_SIZE * TILE_SIZE + (GRID_SIZE - 1) * TILE_GAP;
@@ -177,8 +184,9 @@
// Show the sequence to the player
function showSequence() {
showingSequence = true;
inputEnabled = false;
+ instructionTxt.setText('Watch the sequence!');
var stepDuration = Math.max(SHOW_STEP_BASE_DURATION - (level - 1) * 30, SHOW_STEP_MIN_DURATION);
// Helper: show all tile images (always visible in this version)
function showAllTiles() {
for (var i = 0; i < tiles.length; i++) {
@@ -196,20 +204,45 @@
enableInput();
return;
}
var idx = sequence[step];
+ // More pronounced visual feedback during sequence showing
+ var tile = tiles[idx];
+ // Scale up the tile to make it more obvious
+ tween(tile, {
+ scaleX: 1.2,
+ scaleY: 1.2
+ }, {
+ duration: stepDuration / 3,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ // Scale back down
+ tween(tile, {
+ scaleX: 1.0,
+ scaleY: 1.0
+ }, {
+ duration: stepDuration / 3,
+ easing: tween.easeIn,
+ onFinish: function onFinish() {
+ LK.setTimeout(function () {
+ showStep(step + 1);
+ }, 100);
+ }
+ });
+ }
+ });
+ // Also keep the flash effect
tiles[idx].flash(stepDuration, TILE_HIGHLIGHT[idx], function () {
- LK.setTimeout(function () {
- showStep(step + 1);
- }, 100);
+ // Flash completed
});
}
showStep(0);
}
// Enable player input
function enableInput() {
inputEnabled = true;
game.inputEnabled = true;
+ instructionTxt.setText('Repeat the sequence!');
inputTimeLeft = Math.max(INPUT_TIME_LIMIT - (level - 1) * 200, 2000);
updateTimerText();
if (inputTimer) {
LK.clearInterval(inputTimer);
START BUTTON. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
A single glowing blue melody symbol in the center, surrounded by soft blue light, abstract sound waves gently radiating outward, dreamy and minimalistic background, magical atmosphere, high contrast lighting, perfect for a music-themed game, 4K, highly detailed. In-Game asset. 2d. High contrast. No shadows
A single glowing green melody symbol in the center, surrounded by soft blue light, abstract sound waves gently radiating outward, dreamy and minimalistic background, magical atmosphere, high contrast lighting, perfect for a music-themed game, 4K, highly detailed. In-Game asset. 2d. High contrast. No shadows
A single glowing red melody symbol in the center, surrounded by soft blue light, abstract sound waves gently radiating outward, dreamy and minimalistic background, magical atmosphere, high contrast lighting, perfect for a music-themed game, 4K, highly detailed. In-Game asset. 2d. High contrast. No shadows
A single glowing yellow melody symbol in the center, surrounded by soft blue light, abstract sound waves gently radiating outward, dreamy and minimalistic background, magical atmosphere, high contrast lighting, perfect for a music-themed game, 4K, highly detailed. In-Game asset. 2d. High contrast. No shadows
A vertical 9:16 mobile game start screen for a music-themed game called "Melody Memory". A glowing blue melody symbol floats in the center, with dreamy blue and purple gradient background. Soft abstract sound waves and light particles surround the symbol. At the top, stylish title text "Melody Memory" in elegant font. In the center, a prominent "Start Game" button with a glowing, rounded design. At the bottom, soft hint text saying "Tap to Start". Futuristic, minimalistic, high contrast, cinematic lighting, 4K, high quality, mobile UI friendly.. In-Game asset. 2d. High contrast. No shadows