User prompt
Arka planı yukarıdan aşağıya kayan sol anahtarları yap
User prompt
Arka planı değiştir
User prompt
Arka planı müzik temalı şeffaf birşey yapabilir miyiz
User prompt
Arcup arcdown arcleft arcright bunlara hoparlör şekli ekledim tıkladıkça beat gibi titreşim ekleyelim
User prompt
note_sixteenth resmini ekledim onu note_eighth'den %10 hızlı yap puanı da 16 olacak şekilde ayarla
User prompt
note_eighth resmini ekledim onu note_quarter'dan %10 hızlı yap puanı da 8 olacak şekilde ayarla
User prompt
note_quarter resmini ekledim onu note_half'tan %10 hızlı yap puanı da 4 olacak şekilde ayarla
User prompt
note_half resmini ekledim onu note_whole'dan %10 hızlı yap puanı 2 olacak şekilde ayarla
User prompt
Hepsini iptal et. Ama assetlerde kalsın tek tek yapacağız. Sadece note_whole 1 puan ve en yavaş olacak şekilde gelsin. Gerisi gelmesin
User prompt
Resimlerle ile puanlar uyumsuz. Hepsini sıfırla. Assetlerde isimleri var tekrar yap
User prompt
Assetlerdeki resimler ile oyunda gelen şekiller uyumsuz. Onları uyumlu hale getir. Merdivenlerin üzerine gelen şekilleri de aynı şekilde koordine et
User prompt
note_half resmini ekledim onu note_whole'dan %10 hızlı yap puanı 2 olacak şekilde ayarla
User prompt
note_half resmini ekledim onu note_whole'dan %10 hızlı yap puanı 2 olacak şekilde ayarla
User prompt
Sırayla yapalım Assetlerde note_whole resmini ekledim onu en yavaş puanı da 1 olacak şekilde ayarla.
User prompt
Assetlerde note_whole resmini ekledim onu en yavaş puanı da 1 olacak şekilde ayarla, note_half resmini ekledim onu note_whole'dan %10 hızlı yap puanı 2 olacak şekilde ayarla, note_quarter resmini ekledim onu note_half'tan %10 hızlı yap puanı da 4 olacak şekilde ayarla, note_eighth resmini ekledim onu note_quarter'dan %10 hızlı yap puanı da 8 olacak şekilde ayarla, note_sixteenth resmini ekledim onu note_eighth'den %10 hızlı yap puanı da 16 olacak şekilde ayarla
User prompt
4 puanlık vurdum 1 puanlığın şekli merdivene geldi. 1 puanlık vurdum daha farklı bir şekil geldi. onları da düzeltelim
User prompt
oyunda çıkan 1 puanlık ile bizim ayarladağımız şekil arasında tutarsızlık var.
User prompt
yada şöyle yapalım puanlar nota adıyla eşit olsun. yani birlik nota 1 puan 2lik 2 puan 4lük 4 puan 8lik 8 puan 16luk 16 puan. oyunda üç seviye yapalım 1inci seviye 50 puana ulaşınca bitsin.
User prompt
| Onaltılık | sixteenth | 16 | Az | bunu yakalamak çok zor oluyor . bunu yakalayana 10 puan verelim direk.
User prompt
32lik çok hızlı oldu imkansız yapmak. onu ipral edelim
User prompt
bunların hepsinin şeklini değiştirebilmem için assetlerini eklemen lazım
User prompt
güncelleme . notalardaki sistem gibi birlik , ikilik , dörtlük, sekizlik , on altılık, otuz ikilik , altmış dörtlük nota yapalım. orijinal müzik nota bilgisine eş değer olsun. bun notolar da normaldeki hızlarıyla eşit olacak hızda gelsinler. örneğim birlik nota 1 hızıyla gelirken 4lük nota 4 hızıyla 32lik nota 32 hızıyla gelsin. fakat 1lik nota çok çıkarken 32lik nota az çıksın ki zorluk orantılı olsun
User prompt
make it more asymmetric
User prompt
merdiven oldu ama biraz asimetrik olsun. düz iyi olmadı
User prompt
Dilersen, bu noktaları dikkate alarak merdiveni daha klasik veya daha farklı bir şekilde tasarlayabiliriz! evet lütfen ve merdivenin sadece basamakları olsun ve bu basamak asset kütüphanesinde olsun ki düzenleme yapabileyim. merdiven yanında korkuluk vb olmasına gerek yok .
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // Light (note) class var Light = Container.expand(function () { var self = Container.call(this); // Properties to be set on creation: // self.direction: 'up' | 'down' | 'left' | 'right' // self.color: 'red' | 'blue' | 'green' | 'yellow' // self.speed: px per tick // self.targetX, self.targetY: where to move toward // Attach note type-specific asset as the light symbol // Always use the correct asset for the note type, matching noteTypes array var noteAssetId; if (self.noteAsset) { noteAssetId = self.noteAsset; } else { // Fallback: find asset from noteTypes array by name noteAssetId = "note_quarter"; for (var i = 0; i < noteTypes.length; ++i) { if (noteTypes[i].name === self.noteType) { noteAssetId = noteTypes[i].asset; break; } } } var light = self.attachAsset(noteAssetId, { anchorX: 0.5, anchorY: 0.5 }); // For hit detection self.radius = light.width * 0.5; // For animation self.active = true; // If false, ignore update // Called every tick self.update = function () { if (!self.active) return; // Move towards center of white circle (never stop at target, just keep moving in that direction) var dx = centerX - self.x; var dy = centerY - self.y; var dist = Math.sqrt(dx * dx + dy * dy); if (dist === 0) dist = 0.0001; // avoid division by zero self.x += self.speed * dx / dist; self.y += self.speed * dy / dist; // Lights never stop moving, so do not clamp or halt at target // --- Add glowing effect: pulse scale and alpha --- var pulse = 0.15 * Math.sin(LK.ticks * 0.25 + self.x + self.y) + 1.0; self.scaleX = pulse; self.scaleY = pulse; self.alpha = 0.85 + 0.15 * Math.sin(LK.ticks * 0.5 + self.x); // --- Add rotation effect --- // Slowed down rotation for a smoother effect self.rotation += 0.045; // rotate slower for a more pleasant effect }; // Animate and destroy on hit/miss self.hit = function (_onFinish) { self.active = false; // Flash the light with a white overlay before animating out LK.effects.flashObject(self, 0xffffff, 120); tween(self, { scaleX: 1.5, scaleY: 1.5, alpha: 0 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { self.destroy(); if (_onFinish) _onFinish(); } }); }; return self; }); // StepLadderBar: Asymmetric, playful step-only ladder (no rails), using a step asset var StepLadderBar = Container.expand(function () { var self = Container.call(this); self.stepCount = 30; // 30 steps self.notes = []; self.stepPositions = []; // Step asset: must be in asset library as 'ladderStep' var stepAsset = LK.getAsset('ladderStep', { anchorX: 0.5, anchorY: 0.5 }); var stepW = stepAsset.width; var stepH = stepAsset.height; var ladderHeight = 2732 - 320; // leave 160px margin top/bottom var startY = 2732 - 160 - stepH / 2; var endY = 160 + stepH / 2; var stepSpacing = (startY - endY) / (self.stepCount - 1); var centerX = 2048 / 2; // Asymmetry parameters var maxOffset = 520; // much larger horizontal offset from center for more dramatic zig-zag for (var i = 0; i < self.stepCount; ++i) { var y = startY - i * stepSpacing; // Alternate left/right, but with more organic, non-uniform pattern var direction = i % 2 === 0 ? 1 : -1; // Stronger sine wave for zig-zag, plus a secondary wave for more organic feel var zigzag = Math.sin(i * Math.PI / 5.2) * maxOffset * 0.85 + Math.sin(i * Math.PI / 2.7) * maxOffset * 0.25; // Larger, more varied jitter for playful irregularity var jitter = (Math.random() - 0.5) * 120 + Math.sin(i * 1.7) * 30; // Occasionally flip direction for extra asymmetry if (i % 7 === 0) direction *= -1; var x = centerX + direction * (maxOffset * 0.6) + zigzag + jitter; self.stepPositions.push({ x: x, y: y }); // Draw step (horizontal bar) var step = self.attachAsset('ladderStep', { anchorX: 0.5, anchorY: 0.5, x: x, y: y, scaleX: 1.0, scaleY: 1.0, alpha: 1.0 }); } // Add a note to the next available step, animating it in self.addNote = function (color) { var idx = self.notes.length; if (idx >= self.stepCount) return; // No more steps var pos = self.stepPositions[idx]; // Use note type-specific asset for step ladder bar notes // Find the noteType from the last hit light (if available) var noteType = 'quarter'; if (lights.length > 0 && lights[0].lastHitNoteType) { noteType = lights[0].lastHitNoteType; } else if (typeof self.lastAddedNoteType === "string") { noteType = self.lastAddedNoteType; } // Always use the correct asset for the note type, matching noteTypes array var noteAssetId; if (lights.length > 0 && lights[0].noteAsset) { noteAssetId = lights[0].noteAsset; } else { noteAssetId = "note_quarter"; for (var i = 0; i < noteTypes.length; ++i) { if (noteTypes[i].name === noteType) { noteAssetId = noteTypes[i].asset; break; } } } var note = self.attachAsset(noteAssetId, { anchorX: 0.5, anchorY: 0.5, x: pos.x, y: pos.y, scaleX: 1.0, scaleY: 1.0, tint: color === 'red' ? 0xff4b4b : color === 'blue' ? 0x4bafff : color === 'green' ? 0x4bff4b : color === 'yellow' ? 0xffe14b : 0xffffff, alpha: 0.0 }); self.notes.push(note); // Animate in: fade and pop tween(note, { alpha: 1, scaleX: 1.2, scaleY: 1.2 }, { duration: 180, easing: tween.easeOut, onFinish: function onFinish() { tween(note, { scaleX: 1.0, scaleY: 1.0 }, { duration: 120, easing: tween.easeIn }); } }); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x181818 }); /**** * Game Code ****/ // Music and sounds // altmışdörtlük // otuzikilik // onaltılık // sekizlik // dörtlük // ikilik // birlik // --- Note shape assets for all note types (for easy editing) --- // Ladder and clef images // Arc and UI shapes // Right (yellow) - high cymbal // Left (green) - low cymbal // Down (blue) - high-pitched drum // Up (red) - main drum // Drum and cymbal sounds for arc taps // --- Layout constants --- // Four quarter arcs (quarter circles) for directions: up, down, left, right // Four colored "light" shapes for incoming notes // Sound effects for each direction // Music (background, optional, not played in MVP) // LK.init.music('bgmusic', {volume: 0.5}); // Quarter-circle arcs (using ellipse, but will be visually quartered by anchor/position) // Sound assets for each direction // Tok davul sesi (up) // Soft davul sesi (down) // Güçlü zil sesi (left) // Zayıf zil sesi (right) var centerX = 2048 / 2; var centerY = 2732 / 2; var centerRadius = 200; // centerCircle radius // --- Animated falling treble clefs background (NEW) --- var fallingClefs = []; var clefCount = 7; for (var i = 0; i < clefCount; ++i) { var clef = LK.getAsset('trebleClefStaff', { anchorX: 0.5, anchorY: 0.5, x: Math.random() * 2048, y: Math.random() * 2732, scaleX: 1.2 + Math.random() * 1.2, scaleY: 0.5 + Math.random() * 1.2, alpha: 0.13 + Math.random() * 0.12, rotation: (Math.random() - 0.5) * 0.3 }); clef._fallSpeed = 1.2 + Math.random() * 1.5; clef._drift = (Math.random() - 0.5) * 0.7; fallingClefs.push(clef); game.addChild(clef); } // --- Step ladder bar: starts at bottom, fills screen vertically --- var stepLadderBar = new StepLadderBar(); stepLadderBar.x = 0; stepLadderBar.y = 0; game.addChild(stepLadderBar); // Arc positions (relative to center) // We want the inner edge of each arc to touch the center circle (radius = 200) // Each arc is 300x300, so the distance from center to arc center = centerRadius + arcW/2 = 200 + 150 = 350 var arcDistance = 200 + 150; // 350 var arcOffset = arcDistance; // alias for compatibility with spawn/target logic var arcW = 300, arcH = 300; // all arcs are quarter circles, so 300x300 // --- Create main elements --- // Center circle var centerCircle = LK.getAsset('centerCircle', { anchorX: 0.5, anchorY: 0.5 }); centerCircle.x = centerX; centerCircle.y = centerY; game.addChild(centerCircle); // Quarter arcs - D-pad style, all arcs directly adjacent to center circle // Up arc: above center, touching at bottom var arcUp = LK.getAsset('arcUp', { anchorX: 0.5, // center horizontally anchorY: 1.0 // bottom }); arcUp.x = centerX; arcUp.y = centerY - centerRadius; game.addChild(arcUp); // Down arc: below center, touching at top var arcDown = LK.getAsset('arcDown', { anchorX: 0.5, // center horizontally anchorY: 0.0 // top }); arcDown.x = centerX; arcDown.y = centerY + centerRadius; game.addChild(arcDown); // Left arc: left of center, touching at right var arcLeft = LK.getAsset('arcLeft', { anchorX: 1.0, // right anchorY: 0.5 // center vertically }); arcLeft.x = centerX - centerRadius; arcLeft.y = centerY; game.addChild(arcLeft); // Right arc: right of center, touching at left var arcRight = LK.getAsset('arcRight', { anchorX: 0.0, // left anchorY: 0.5 // center vertically }); arcRight.x = centerX + centerRadius; arcRight.y = centerY; game.addChild(arcRight); // --- Arc hitboxes for input detection --- var arcHitboxes = [{ dir: 'up', x: centerX, y: centerY - centerRadius - arcH / 2, w: arcW, h: arcH, color: 'red', asset: arcUp }, { dir: 'down', x: centerX, y: centerY + centerRadius + arcH / 2, w: arcW, h: arcH, color: 'blue', asset: arcDown }, { dir: 'left', x: centerX - centerRadius - arcW / 2, y: centerY, w: arcW, h: arcH, color: 'green', asset: arcLeft }, { dir: 'right', x: centerX + centerRadius + arcW / 2, y: centerY, w: arcW, h: arcH, color: 'yellow', asset: arcRight }]; // --- Score, lives and wave display --- var score = 0; var lives = 10; var scoreTxt = new Text2('0', { size: 120, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Lives display (top right, away from menu) var livesTxt = new Text2('♥ 10', { size: 100, fill: 0xff4b4b }); livesTxt.anchor.set(1, 0); // right aligned, top LK.gui.topRight.addChild(livesTxt); // --- Light management --- var lights = []; // No lightActive flag needed; allow multiple lights at once // --- Color mapping for directions --- var dirColor = { 'up': 'red', 'down': 'blue', 'left': 'green', 'right': 'yellow' }; var dirSound = { 'up': 'drumRed', 'down': 'drumBlue', 'left': 'drumGreen', 'right': 'drumYellow' }; var dirBg = { 'up': 0xff4b4b, 'down': 0x4bafff, 'left': 0x4bff4b, 'right': 0xffe14b }; // --- Light spawn positions (offscreen, towards arcs) --- function getLightSpawn(dir) { var dist = 700; // distance from center if (dir === 'up') return { x: centerX, y: centerY - arcOffset - dist }; if (dir === 'down') return { x: centerX, y: centerY + arcOffset + dist }; if (dir === 'left') return { x: centerX - arcOffset - dist, y: centerY }; if (dir === 'right') return { x: centerX + arcOffset + dist, y: centerY }; return { x: centerX, y: centerY }; } function getLightTarget(dir) { if (dir === 'up') return { x: centerX, y: centerY - arcOffset }; if (dir === 'down') return { x: centerX, y: centerY + arcOffset }; if (dir === 'left') return { x: centerX - arcOffset, y: centerY }; if (dir === 'right') return { x: centerX + arcOffset, y: centerY }; return { x: centerX, y: centerY }; } // --- Note types and their musical properties --- // Each note type uses its own asset, speed, and point value as described: // - note_whole: slowest, 1 point // - note_half: 10% faster than whole, 2 points // - note_quarter: 10% faster than half, 4 points // - note_eighth: 10% faster than quarter, 8 points // - note_sixteenth: 10% faster than eighth, 16 points var noteTypes = [{ name: "whole", asset: "note_whole", speed: 1.0, points: 1, weight: 1 }, { name: "half", asset: "note_half", speed: 1.1, // 10% faster than whole points: 2, weight: 1 }, { name: "quarter", asset: "note_quarter", speed: 1.1 * 1.1, // 10% faster than half points: 4, weight: 1 }, { name: "eighth", asset: "note_eighth", speed: 1.1 * 1.1 * 1.1, // 10% faster than quarter points: 8, weight: 1 }, { name: "sixteenth", asset: "note_sixteenth", speed: 1.1 * 1.1 * 1.1 * 1.1, // 10% faster than eighth points: 16, weight: 1 }]; // note_whole, note_half, note_quarter ve note_eighth kullanılacak // Precompute weighted note type array for random selection var weightedNoteTypes = []; for (var i = 0; i < noteTypes.length; ++i) { for (var j = 0; j < noteTypes[i].weight; ++j) { weightedNoteTypes.push(noteTypes[i]); } } // note_whole, note_half, note_quarter ve note_eighth eklendi // --- Light speed: base speed for whole note, others are multiples --- function getLightSpeedForNoteType(noteType) { // Use the new speed property from noteTypes // 1.2 is the original base, but we want whole note to be slow, others faster var base = 1.2; if (score < 5) base *= 1.2;else if (score < 20) base *= 1.7;else base *= 2.2; // noteType can be either a noteType object or a {name: ...} object var speedMultiplier = noteType.speed !== undefined ? noteType.speed : 1.0; return base * speedMultiplier; } // --- Spawn a light (note) with note type --- function spawnLight(dir) { var color = dirColor[dir]; var spawn = getLightSpawn(dir); var target = getLightTarget(dir); // note_whole veya note_half rastgele seçilecek var noteType = weightedNoteTypes[Math.floor(Math.random() * weightedNoteTypes.length)]; var light = new Light(); light.noteType = noteType.name; light.noteAsset = noteType.asset; light.notePoints = noteType.points; light.direction = dir; light.color = color; light.x = spawn.x; light.y = spawn.y; light.targetX = target.x; light.targetY = target.y; light.speed = getLightSpeedForNoteType(noteType); // Asset düzeltmesi: ilgili nota için özel asset kullan if (light.children && light.children.length > 0) { for (var i = light.children.length - 1; i >= 0; --i) { light.removeChild(light.children[i]); } } var noteAssetObj = light.attachAsset(noteType.asset, { anchorX: 0.5, anchorY: 0.5 }); light.radius = noteAssetObj.width * 0.5; lights.push(light); game.addChild(light); // No lightActive flag or logic needed } // --- Continuous light spawning logic --- // Timers for continuous spawning var lightSpawnTimer = null; var showInfoTimer = null; var dirs = ['up', 'down', 'left', 'right']; function clearLightTimers() { if (lightSpawnTimer !== null) { LK.clearTimeout(lightSpawnTimer); lightSpawnTimer = null; } if (showInfoTimer !== null) { LK.clearTimeout(showInfoTimer); showInfoTimer = null; } } // Main continuous light spawning function function startLightSpawning() { clearLightTimers(); // Always spawn at random intervals, but ensure at least 2 seconds between spawns var baseInterval, randomRange, minInterval; if (score < 20) { baseInterval = 320; randomRange = 260; minInterval = 2000; } else { // After score 20, make spawn intervals more irregular and sometimes much faster baseInterval = 80 + Math.floor(Math.random() * 120); // base between 80-200ms randomRange = 400 + Math.floor(Math.random() * 200); // random up to 600ms minInterval = 1200 + Math.floor(Math.random() * 600); // min interval 1200-1800ms } // Spawn a light var dir = dirs[Math.floor(Math.random() * 4)]; spawnLight(dir); // Schedule next light var nextInterval = baseInterval; if (randomRange > 0) { nextInterval += Math.floor(Math.random() * randomRange); } // Enforce minimum interval of 1 second (1000ms) if (nextInterval < minInterval) { nextInterval = minInterval; } lightSpawnTimer = LK.setTimeout(function () { startLightSpawning(); }, nextInterval); } // Call this to (re)start spawning after all lights cleared function startWave() { startLightSpawning(); } // --- Handle tap input --- function getDirectionFromPoint(x, y) { // Returns 'up', 'down', 'left', 'right' or null for (var i = 0; i < arcHitboxes.length; ++i) { var arc = arcHitboxes[i]; // Use bounding box for MVP var dx = x - arc.x; var dy = y - arc.y; if (arc.dir === 'up' || arc.dir === 'down') { if (Math.abs(dx) < arc.w / 2 && Math.abs(dy) < arc.h / 2) return arc.dir; } else { if (Math.abs(dx) < arc.w / 2 && Math.abs(dy) < arc.h / 2) return arc.dir; } } return null; } // --- Handle tap (down) --- game.down = function (x, y, obj) { // Use the provided x, y directly as they are already in game coordinates var dir = getDirectionFromPoint(x, y); if (!dir) return; // Always play the arc's sound on tap, even if no light is present var soundPlayed = false; LK.getSound(dirSound[dir]).play(); soundPlayed = true; // --- Beat vibration/tween effect for arc images (hoparlör titreşim) --- var arcObj = null; if (dir === 'up') arcObj = arcUp;else if (dir === 'down') arcObj = arcDown;else if (dir === 'left') arcObj = arcLeft;else if (dir === 'right') arcObj = arcRight; if (arcObj) { // Stop any previous tweens on this arc tween.stop(arcObj, { scaleX: true, scaleY: true }); // Animate: quick scale up and back (beat effect) var origScaleX = arcObj.scaleX !== undefined ? arcObj.scaleX : 1; var origScaleY = arcObj.scaleY !== undefined ? arcObj.scaleY : 1; tween(arcObj, { scaleX: origScaleX * 1.18, scaleY: origScaleY * 1.18 }, { duration: 60, easing: tween.easeOut, onFinish: function onFinish() { tween(arcObj, { scaleX: origScaleX, scaleY: origScaleY }, { duration: 90, easing: tween.easeIn }); } }); } // Find the closest active light matching direction and close enough for (var i = 0; i < lights.length; ++i) { var light = lights[i]; if (!light.active) continue; // If direction matches and light is close enough to arc var target = getLightTarget(dir); var dx = light.x - target.x; var dy = light.y - target.y; var dist = Math.sqrt(dx * dx + dy * dy); // Only allow tap if light has entered arc zone and has NOT reached centerCircle var dxCenter = light.x - centerX; var dyCenter = light.y - centerY; var distCenter = Math.sqrt(dxCenter * dxCenter + dyCenter * dyCenter); if (light.direction === dir && light.enteredArc === true && distCenter > centerRadius) { // Correct! // Animate note to step ladder bar instead of destroying light.active = false; var startX = light.x; var startY = light.y; var idx = stepLadderBar.notes.length; var endX = stepLadderBar.x + 190; var endY = stepLadderBar.y + (stepLadderBar.stepYs && stepLadderBar.stepYs[idx] !== undefined ? stepLadderBar.stepYs[idx] : 30 + idx * 90); // Track last hit note type for correct asset on step ladder bar stepLadderBar.lastAddedNoteType = light.noteType; light.lastHitNoteType = light.noteType; tween(light, { x: endX, y: endY, scaleX: 1.1, scaleY: 1.1, alpha: 1 }, { duration: 340, easing: tween.easeIn, onFinish: function onFinish() { // Remove from array and destroy light for (var j = 0; j < lights.length; ++j) { if (lights[j] === light) { lights.splice(j, 1); break; } } light.destroy(); // Add a note to the step ladder bar stepLadderBar.addNote(light.color); } }); // Her nota tipi kendi değeri kadar puan kazandırır var noteScoreTable = { whole: 1, half: 2, quarter: 4, eighth: 8, sixteenth: 16 }; // note_whole 1 puan, note_half 2 puan score += noteScoreTable[light.noteType] || 1; scoreTxt.setText(score); // Check for win condition: 1. seviye 50 puan if (score >= 50) { LK.showYouWin(); return; } // Play sound // (Already played above, do not play again) // Flash background tween.stop(game, { backgroundColor: true }); var oldBg = game.backgroundColor; // If blue arc (down) light is tapped, set background to blue and keep it if (dir === 'down') { game.setBackgroundColor(0x4bafff); } else if (dir === 'left') { // If green arc (left) light is tapped, set background to green and keep it game.setBackgroundColor(0x4bff4b); } else if (dir === 'right') { // If yellow arc (right) light is tapped, set background to yellow and keep it game.setBackgroundColor(0xffe14b); } else if (dir === 'up') { // If red arc (up) light is tapped, set background to red and keep it game.setBackgroundColor(0xff4b4b); } else { tween(game, { backgroundColor: dirBg[dir] }, { duration: 120, onFinish: function onFinish() { tween(game, { backgroundColor: oldBg }, { duration: 400 }); } }); } // No need to spawn next light here; continuous spawn is always active return; } } // If tap is on arc but no light is close: miss // Flash red and lose a life lives -= 1; livesTxt.setText('♥ ' + lives); LK.effects.flashScreen(0xff0000, 500); if (lives <= 0) { LK.showGameOver(); } }; // --- Update loop: check for missed lights --- game.update = function () { // Animate falling treble clefs background for (var i = 0; i < fallingClefs.length; ++i) { var clef = fallingClefs[i]; clef.y += clef._fallSpeed; clef.x += clef._drift; clef.rotation += 0.001 * clef._drift; if (clef.y > 2732 + 200) { clef.y = -200; clef.x = 200 + Math.random() * (2048 - 400); clef._fallSpeed = 1.2 + Math.random() * 1.5; clef._drift = (Math.random() - 0.5) * 0.7; clef.scaleX = 1.2 + Math.random() * 1.2; clef.scaleY = 0.5 + Math.random() * 1.2; clef.alpha = 0.13 + Math.random() * 0.12; clef.rotation = (Math.random() - 0.5) * 0.3; } } for (var i = lights.length - 1; i >= 0; --i) { var light = lights[i]; if (!light.active) continue; // Calculate distance to arc (where tap is allowed to start) var arcTarget = getLightTarget(light.direction); var dxArc = light.x - arcTarget.x; var dyArc = light.y - arcTarget.y; var distArc = Math.sqrt(dxArc * dxArc + dyArc * dyArc); // Calculate distance to centerCircle (where tap is no longer allowed, and game over if reached) var dxCenter = light.x - centerX; var dyCenter = light.y - centerY; var distCenter = Math.sqrt(dxCenter * dxCenter + dyCenter * dyCenter); // Track if light has entered the arc zone (first contact) if (light.enteredArc === undefined) { // If light is outside arc zone, not yet entered light.enteredArc = false; } // If not yet entered arc, check if it just entered if (!light.enteredArc && light.lastDistArc !== undefined && light.lastDistArc >= 120 && distArc < 120) { light.enteredArc = true; } light.lastDistArc = distArc; // If light has entered arc, but now reached centerCircle: game over immediately if (light.enteredArc && distCenter < centerRadius) { light.hit(function () { for (var j = 0; j < lights.length; ++j) { if (lights[j] === light) { lights.splice(j, 1); break; } } // Flash red and trigger game over immediately LK.effects.flashScreen(0xff0000, 500); LK.showGameOver(); }); continue; } } // No batch logic needed; continuous spawn is always active }; // --- Start game --- score = 0; lives = 10; scoreTxt.setText(score); livesTxt.setText('♥ ' + lives); // Play background beat music (loops by default) LK.playMusic('beat'); LK.setTimeout(function () { startWave(); }, 600); ; ;
===================================================================
--- original.js
+++ change.js
@@ -222,21 +222,27 @@
// Zayıf zil sesi (right)
var centerX = 2048 / 2;
var centerY = 2732 / 2;
var centerRadius = 200; // centerCircle radius
-// --- Music-themed transparent background (NEW) ---
-var musicBg = LK.getAsset('trebleClefStaff', {
- anchorX: 0.5,
- anchorY: 0.5,
- x: 2048 / 2,
- y: 2732 / 2,
- scaleX: 2.5,
- // changed scale for a different look
- scaleY: 6.5,
- // changed scale for a different look
- alpha: 0.25 // increased alpha for more visible background
-});
-game.addChild(musicBg);
+// --- Animated falling treble clefs background (NEW) ---
+var fallingClefs = [];
+var clefCount = 7;
+for (var i = 0; i < clefCount; ++i) {
+ var clef = LK.getAsset('trebleClefStaff', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: Math.random() * 2048,
+ y: Math.random() * 2732,
+ scaleX: 1.2 + Math.random() * 1.2,
+ scaleY: 0.5 + Math.random() * 1.2,
+ alpha: 0.13 + Math.random() * 0.12,
+ rotation: (Math.random() - 0.5) * 0.3
+ });
+ clef._fallSpeed = 1.2 + Math.random() * 1.5;
+ clef._drift = (Math.random() - 0.5) * 0.7;
+ fallingClefs.push(clef);
+ game.addChild(clef);
+}
// --- Step ladder bar: starts at bottom, fills screen vertically ---
var stepLadderBar = new StepLadderBar();
stepLadderBar.x = 0;
stepLadderBar.y = 0;
@@ -720,8 +726,25 @@
}
};
// --- Update loop: check for missed lights ---
game.update = function () {
+ // Animate falling treble clefs background
+ for (var i = 0; i < fallingClefs.length; ++i) {
+ var clef = fallingClefs[i];
+ clef.y += clef._fallSpeed;
+ clef.x += clef._drift;
+ clef.rotation += 0.001 * clef._drift;
+ if (clef.y > 2732 + 200) {
+ clef.y = -200;
+ clef.x = 200 + Math.random() * (2048 - 400);
+ clef._fallSpeed = 1.2 + Math.random() * 1.5;
+ clef._drift = (Math.random() - 0.5) * 0.7;
+ clef.scaleX = 1.2 + Math.random() * 1.2;
+ clef.scaleY = 0.5 + Math.random() * 1.2;
+ clef.alpha = 0.13 + Math.random() * 0.12;
+ clef.rotation = (Math.random() - 0.5) * 0.3;
+ }
+ }
for (var i = lights.length - 1; i >= 0; --i) {
var light = lights[i];
if (!light.active) continue;
// Calculate distance to arc (where tap is allowed to start)
beat
Music
drumRed
Sound effect
drumGreen
Sound effect
beat2
Music
beat3
Music
beat4
Music
harp4
Sound effect
oboe4
Sound effect
harp1
Sound effect
harp2
Sound effect
harp3
Sound effect
piano1
Sound effect
piano2
Sound effect
piano3
Sound effect
piano4
Sound effect
drum4
Sound effect
oboe1
Sound effect
oboe2
Sound effect
oboe3
Sound effect