User prompt
Varlıklara bir tane daha müzik nodası ekle.
User prompt
Varlıklara bir tane daha müzik notası ekle.
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'y')' in or related to this line: 'var lifeIconsY = scoreTxt.y + scoreTxt.height + 30;' Line Number: 60
User prompt
Canları puanin altinda 3 adet kutuyla goster
User prompt
Oyunun adını meme yakalama olarak değiştirin.
User prompt
Nota pianoya çarpinca puan verme can kaybet
User prompt
Notalar yere düsunce 20 puan eksilt
User prompt
Kalpleri aşağıya taşı
User prompt
Notalar yere düsunce puan 10 ar ekdilsin
User prompt
Lazeri yukarı ekranin üstüne kadar uzar ve incelt
User prompt
kalp ekle 3 tane, 1 müzik noktasını kaçırırsam 1 kalp gitsin.
User prompt
can barını alta al
User prompt
Camberini biraz alta al.
User prompt
can barı ekle gözüksün, 3 tane canımız olsun
User prompt
Can Bar'a ekle 3 tane canımız olsun.
User prompt
Tüm kodları ve asset leri gözden ğecir
User prompt
Her müzik notunu yakaladığımızda puanımız otomatik olarak onlar artsın.
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading '0')' in or related to this line: 'var beam = beams[keyIndex];' Line Number: 201
User prompt
Piyanoya oyunu ekle.
User prompt
Piyanoya basinca nota rastgeke nota çalsın ve yukarıya dogrü ince bir çizgi halinde tutreye lazer ısıgi göndersin basili kaldıgi syrece
User prompt
Piyanoyu varlıklardan kaldır.
User prompt
Skor zemine düşmeden nota vurulursa olsun.
User prompt
Skor hep sıfır gıüncelkenmiyor sorunu çoz
User prompt
Oyundaki sorunları guder gereksiz kodları temizle skor pNosunu iyilestir
User prompt
Show skor panosu update every bonus
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // Müzik parçası (düşen nota) sınıfı var MusicNote = Container.expand(function () { var self = Container.call(this); // Nota görselini ekle ve ortala var note = self.attachAsset('musicNote', { anchorX: 0.5, anchorY: 0.5 }); // Hız (tüm notalar için sabit) self.speed = 10; // Tıklanıp tıklanmadığını takip et self.collected = false; // Her frame çağrılır self.update = function () { self.y += self.speed; }; // Tıklama/dokunma olayı self.down = function (x, y, obj) { // Artık dokununca hiçbir şey olmasın }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x181818 }); /**** * Game Code ****/ // Nota sesleri (her tuş için bir tane, asset id'leri örnek) // Müzik arka planı // Lazer ışığı için kutu asset (renkli) // Piyano tuşu ve lazer için kutu şeklinde asset // Nota görseli // Daire, kutu ve bar için tek bir asset tanımı yeterli // Sağ üst köşeye üç can (life) ekle var lifeCount = 3; var lifeIcons = []; var lifeIconSize = 90; var lifeIconMargin = 30; for (var i = 0; i < 3; i++) { // Basit bir daire şeklinde cam simgesi (yeşil) var lifeIcon = LK.getAsset('centerCircle', { width: lifeIconSize, height: lifeIconSize, color: 0x00FF99, shape: 'ellipse', anchorX: 1, anchorY: 0, x: 2048 - i * (lifeIconSize + lifeIconMargin), y: 0 }); LK.gui.topRight.addChild(lifeIcon); lifeIcons.push(lifeIcon); } // Can barı ekle (üstte, görsel bar) var canBarWidth = 400; var canBarHeight = 32; var canBarBg = LK.getAsset('centerCircle', { width: canBarWidth, height: canBarHeight, color: 0x333333, shape: 'box', anchorX: 1, anchorY: 0, x: 2048 - 3 * (lifeIconSize + lifeIconMargin) - 40, y: 30 }); LK.gui.topRight.addChild(canBarBg); var canBarFill = LK.getAsset('centerCircle', { width: canBarWidth, height: canBarHeight, color: 0x00FF99, shape: 'box', anchorX: 1, anchorY: 0, x: 2048 - 3 * (lifeIconSize + lifeIconMargin) - 40, y: 30 }); LK.gui.topRight.addChild(canBarFill); // Can barını güncelleyen fonksiyon function updateCanBar() { var ratio = Math.max(0, Math.min(1, lifeCount / 3)); canBarFill.width = canBarWidth * ratio; } updateCanBar(); // Başlangıç mesajı var startMsg = new Text2('Meme Müzik\nBaşlamak için ekrana dokun!', { size: 120, fill: 0xFFD700, align: 'center' }); startMsg.anchor.set(0.5, 0.5); startMsg.x = 2048 / 2; startMsg.y = 2732 / 2; game.addChild(startMsg); // Oyun başlatılana kadar notalar gelmesin, skor sıfırlanmasın var gameStarted = false; // Not ve zamanlayıcıyı başlatan fonksiyon function startGame() { if (gameStarted) return; gameStarted = true; if (startMsg && startMsg.parent) startMsg.parent.removeChild(startMsg); LK.setScore(0); scoreTxt.setText('0'); // Güzel bir müzik başlat LK.playMusic('musicId', { fade: { start: 0, end: 1, duration: 1000 } }); scheduleNextNote(); } // Ekrana ilk dokunuşta oyunu başlat game.down = function (x, y, obj) { if (!gameStarted) { startGame(); return; } }; // Not spawn ve zamanlayıcıyı başlatmayı engelle // Skor başlığı var scoreLabel = new Text2('SKOR', { size: 90, fill: 0xFFD700, align: 'center', font: "'GillSans-Bold',Impact,'Arial Black',Tahoma" }); scoreLabel.anchor.set(0.5, 1); LK.gui.top.addChild(scoreLabel); scoreLabel.y = 90; var scoreTxt = new Text2('0', { size: 180, fill: 0xffffff, font: "'GillSans-Bold',Impact,'Arial Black',Tahoma", align: 'center', stroke: '#222222', strokeThickness: 8 }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); scoreTxt.y = 60 + scoreLabel.height; // Düşen notaların tutulduğu dizi var notes = []; // Sadece piyano tuşlarını ekle (beyaz ve siyah tuşlar) // Tuş sayısı ve boyutları var keyCount = 7; var keys = []; // Beyaz tuşlar için genişlik, tüm ekranı kaplayacak şekilde hesaplanır var keyMargin = 0; // Tuşlar bitişik olacak var keyWidth = Math.floor(2048 / keyCount); var keyHeight = 220; var keysY = 2732 - keyHeight / 2 - 20; // 20px alt boşluk var startX = keyWidth / 2; // Her tuş için ayrı bir ışık hüzmesi (beam) oluşturulacak ve başta görünmez olacak var beamHeight = 40; var beamY = keysY - keyHeight / 2 - beamHeight / 2 + 10; // tuşların hemen önünde var beams = []; for (var i = 0; i < keyCount; i++) { var beam = game.addChild(LK.getAsset('beam', { width: keyWidth, height: beamHeight, anchorX: 0.5, anchorY: 0.5, x: startX + i * keyWidth, y: beamY })); beam.alpha = 0; // Başta görünmez beams.push(beam); } // Beyaz tuşlar for (var i = 0; i < keyCount; i++) { var key = game.addChild(LK.getAsset('pianoKey', { width: keyWidth, height: keyHeight, anchorX: 0.5, anchorY: 0.5, x: startX + i * keyWidth, y: keysY })); // Her tuş için lazer ışığı ve ses kontrolü (function (keyIndex) { var beam = beams[keyIndex]; var laserActive = false; var laserTween = null; var noteSounds = [{ id: 'noteC', volume: 1 }, { id: 'noteD', volume: 1 }, { id: 'noteE', volume: 1 }, { id: 'noteF', volume: 1 }, { id: 'noteG', volume: 1 }, { id: 'noteA', volume: 1 }, { id: 'noteB', volume: 1 }]; // Not seslerini başlat (asset olarak eklenmiş olmalı) // Her tuş için farklı bir nota sesi çalacak key.down = function (x, y, obj) { if (laserActive) return; laserActive = true; // Rastgele bir nota sesi çal var soundIdx = Math.floor(Math.random() * noteSounds.length); var noteSound = noteSounds[soundIdx]; if (LK.getSound && LK.getSound(noteSound.id)) { LK.getSound(noteSound.id).play(); } // Lazer ışığını yukarıya doğru uzat ve görünür yap var originalHeight = beam.height; var extendedHeight = 2048; // Tüm yukarıya kadar uzasın var originalY = beam.y; beam.alpha = 1; beam.height = extendedHeight; beam.y = originalY - (extendedHeight - originalHeight) / 2; // Lazer aktifken sürekli notaları kontrol et beam._laserInterval = LK.setInterval(function () { for (var n = notes.length - 1; n >= 0; n--) { var note = notes[n]; if (!note.collected) { if (note.x + note.width / 2 >= beam.x - keyWidth / 2 && note.x - note.width / 2 <= beam.x + keyWidth / 2 && note.y + note.height / 2 >= beam.y - beam.height / 2 && note.y - note.height / 2 <= beam.y + beam.height / 2) { note.collected = true; tween(note, { alpha: 0, scaleX: 1.5, scaleY: 1.5 }, { duration: 120, easing: tween.easeOut, onFinish: function (note, n) { return function () { note.destroy(); }; }(note, n) }); notes.splice(n, 1); } } } }, 30); // 30ms'de bir kontrol et }; key.up = function (x, y, obj) { if (!laserActive) return; laserActive = false; // Lazer ışığını animasyonla eski haline döndür if (beam._laserInterval) { LK.clearInterval(beam._laserInterval); beam._laserInterval = null; } tween(beam, { alpha: 0, height: beamHeight, y: beamY, scaleY: 1 }, { duration: 200, easing: tween.easeOut }); }; })(i); keys.push(key); } // Yeni nota oluşturma fonksiyonu function spawnNote() { var note = new MusicNote(); // Rastgele x (ekranın kenarına taşmasın) var margin = 180; note.x = margin + Math.random() * (2048 - 2 * margin); // Y: Menüyle çakışmasın diye -100 yerine -320'den başlat (yüksekliği kadar yukarıdan) note.y = -320; note.scaleX = 1; note.scaleY = 1; note.alpha = 1; note.collected = false; notes.push(note); game.addChild(note); } // Notaların rastgele aralıklarla gelmesi için zamanlayıcı var minInterval = 500; var maxInterval = 1200; var noteTimer = null; function scheduleNextNote() { var interval = minInterval + Math.random() * (maxInterval - minInterval); noteTimer = LK.setTimeout(function () { spawnNote(); scheduleNextNote(); }, interval); } // scheduleNextNote(); // Oyun güncelleme döngüsü game.update = function () { for (var i = notes.length - 1; i >= 0; i--) { var note = notes[i]; // Not güncelle note.update(); // Piyano tuşlarına değdi mi? (Yalnızca henüz toplanmamışsa ve nota henüz zemine değmemişse) if (!note.collected && note.y + note.height / 2 >= keysY - keyHeight / 2 && note.y + note.height / 2 < keysY + keyHeight / 2 // Yani henüz zemine değmeden ) { var _loop = function _loop() { key = keys[k]; if (note.x + note.width / 2 >= key.x - keyWidth / 2 && note.x - note.width / 2 <= key.x + keyWidth / 2) { var animateScore = function animateScore(from, to) { var scoreAnim = { value: from }; tween(scoreAnim, { value: to }, { duration: 400, easing: tween.easeOut, onUpdate: function onUpdate() { scoreTxt.setText(Math.floor(scoreAnim.value)); // Skor büyüt/küçült animasyonu scoreTxt.scaleX = scoreTxt.scaleY = 1.15; }, onFinish: function onFinish() { scoreTxt.setText(to); tween(scoreTxt, { scaleX: 1, scaleY: 1 }, { duration: 120, easing: tween.easeOut }); } }); }; // 300 puana ulaşıldıysa oyunu kazan // Notayı yakala note.collected = true; // Skoru artır (her zaman 10x ekle) prevScore = LK.getScore(); newScore = prevScore + 10 * 10; // Her nota için 10x puan ekle LK.setScore(newScore); animateScore(prevScore, newScore); if (LK.getScore() >= 300) { LK.showYouWin(); } // Kısa bir animasyonla kaybolsun tween(note, { alpha: 0, scaleX: 1.5, scaleY: 1.5 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { note.destroy(); } }); notes.splice(i, 1); return 1; // break } }, key, prevScore, newScore; // Beyaz tuşlardan birine denk geliyorsa yakalandı say for (var k = 0; k < keyCount; k++) { if (_loop()) break; } continue; } // Ekranın dışına çıktıysa veya toplandıysa sil if (note.y - note.height / 2 > 2732 + 50) { // Nota kaçtıysa can azalt if (!note.collected) { lifeCount--; updateCanBar(); // Can ikonlarını güncelle (görsel olarak sil) if (lifeIcons[lifeCount]) { lifeIcons[lifeCount].alpha = 0.2; } // Can bitti mi? if (lifeCount <= 0) { LK.showGameOver(); return; } } note.destroy(); notes.splice(i, 1); } else if (note.collected) { note.destroy(); notes.splice(i, 1); } } }; // Oyun sıfırlanırken zamanlayıcıyı temizle game.destroy = function () { if (noteTimer) LK.clearTimeout(noteTimer); // Müziği durdur LK.stopMusic(); }; // Skor değiştiğinde skor panosunu güncelle (her durumda güncel tut) LK.on('score', function (newScore) { // Skor animasyonu başka yerde çalışıyorsa, burada sadece güncel tut if (!scoreTxt._isAnimating) { scoreTxt.setText(newScore); } }); // Oyun başladığında ilk skor sıfırlansın // LK.setScore(0); // scoreTxt.setText('0'); // Oyun alanında başka bir şey yok, sadece notalar ve skor var.
===================================================================
--- original.js
+++ change.js
@@ -5,12 +5,12 @@
/****
* Classes
****/
-// Müzik parçası (düşen kutu) sınıfı
+// Müzik parçası (düşen nota) sınıfı
var MusicNote = Container.expand(function () {
var self = Container.call(this);
- // Asseti ekle ve ortala
+ // Nota görselini ekle ve ortala
var note = self.attachAsset('musicNote', {
anchorX: 0.5,
anchorY: 0.5
});
@@ -38,10 +38,15 @@
/****
* Game Code
****/
-// Sağ üst köşeye üç cam (can) ekle
-// Oyun alanında başka bir şey yok, sadece notalar ve skor var.;
+// Nota sesleri (her tuş için bir tane, asset id'leri örnek)
+// Müzik arka planı
+// Lazer ışığı için kutu asset (renkli)
+// Piyano tuşu ve lazer için kutu şeklinde asset
+// Nota görseli
+// Daire, kutu ve bar için tek bir asset tanımı yeterli
+// Sağ üst köşeye üç can (life) ekle
var lifeCount = 3;
var lifeIcons = [];
var lifeIconSize = 90;
var lifeIconMargin = 30;
@@ -91,9 +96,9 @@
canBarFill.width = canBarWidth * ratio;
}
updateCanBar();
// Başlangıç mesajı
-var startMsg = new Text2('Piyano Oyunu\nBaşlamak için ekrana dokun!', {
+var startMsg = new Text2('Meme Müzik\nBaşlamak için ekrana dokun!', {
size: 120,
fill: 0xFFD700,
align: 'center'
});
@@ -127,112 +132,153 @@
return;
}
};
// Not spawn ve zamanlayıcıyı başlatmayı engelle
-// scheduleNextNote();
-// Müzik parçası için renkli bir kutu şeklinde asset
-// Animasyonlar için tween eklentisi
// Skor başlığı
-var scoreLabel = new Text2('Skor', {
- size: 70,
+var scoreLabel = new Text2('SKOR', {
+ size: 90,
fill: 0xFFD700,
- align: 'center'
+ align: 'center',
+ font: "'GillSans-Bold',Impact,'Arial Black',Tahoma"
});
scoreLabel.anchor.set(0.5, 1);
LK.gui.top.addChild(scoreLabel);
-scoreLabel.y = 80;
+scoreLabel.y = 90;
var scoreTxt = new Text2('0', {
- size: 120,
- fill: 0xFFFFFF
+ size: 180,
+ fill: 0xffffff,
+ font: "'GillSans-Bold',Impact,'Arial Black',Tahoma",
+ align: 'center',
+ stroke: '#222222',
+ strokeThickness: 8
});
scoreTxt.anchor.set(0.5, 0);
-// Skor üstte ortada, menüyle çakışmasın diye biraz aşağıda
LK.gui.top.addChild(scoreTxt);
-scoreTxt.y = 40 + scoreLabel.height;
+scoreTxt.y = 60 + scoreLabel.height;
// Düşen notaların tutulduğu dizi
var notes = [];
-// Piyano tuşları ve ışık huzmeleri (beam) ekle
+// Sadece piyano tuşlarını ekle (beyaz ve siyah tuşlar)
+// Tuş sayısı ve boyutları
var keyCount = 7;
var keys = [];
-var keyMargin = 0;
+// Beyaz tuşlar için genişlik, tüm ekranı kaplayacak şekilde hesaplanır
+var keyMargin = 0; // Tuşlar bitişik olacak
var keyWidth = Math.floor(2048 / keyCount);
var keyHeight = 220;
-var keysY = 2732 - keyHeight / 2 - 20;
+var keysY = 2732 - keyHeight / 2 - 20; // 20px alt boşluk
var startX = keyWidth / 2;
// Her tuş için ayrı bir ışık hüzmesi (beam) oluşturulacak ve başta görünmez olacak
var beamHeight = 40;
-var beamY = keysY - keyHeight / 2 - beamHeight / 2 + 10;
+var beamY = keysY - keyHeight / 2 - beamHeight / 2 + 10; // tuşların hemen önünde
var beams = [];
for (var i = 0; i < keyCount; i++) {
- var beam = game.addChild(LK.getAsset('piano', {
+ var beam = game.addChild(LK.getAsset('beam', {
width: keyWidth,
height: beamHeight,
- color: 0xFFFF99,
- shape: 'box',
anchorX: 0.5,
anchorY: 0.5,
x: startX + i * keyWidth,
y: beamY
}));
- beam.alpha = 0;
+ beam.alpha = 0; // Başta görünmez
beams.push(beam);
}
// Beyaz tuşlar
for (var i = 0; i < keyCount; i++) {
- var key = game.addChild(LK.getAsset('piano', {
+ var key = game.addChild(LK.getAsset('pianoKey', {
width: keyWidth,
height: keyHeight,
- color: 0xffffff,
- shape: 'box',
anchorX: 0.5,
anchorY: 0.5,
x: startX + i * keyWidth,
y: keysY
}));
- // Her tuşa basıldığında önündeki beam'i göster ve notaları yok et
+ // Her tuş için lazer ışığı ve ses kontrolü
(function (keyIndex) {
+ var beam = beams[keyIndex];
+ var laserActive = false;
+ var laserTween = null;
+ var noteSounds = [{
+ id: 'noteC',
+ volume: 1
+ }, {
+ id: 'noteD',
+ volume: 1
+ }, {
+ id: 'noteE',
+ volume: 1
+ }, {
+ id: 'noteF',
+ volume: 1
+ }, {
+ id: 'noteG',
+ volume: 1
+ }, {
+ id: 'noteA',
+ volume: 1
+ }, {
+ id: 'noteB',
+ volume: 1
+ }];
+ // Not seslerini başlat (asset olarak eklenmiş olmalı)
+ // Her tuş için farklı bir nota sesi çalacak
key.down = function (x, y, obj) {
- var beam = beams[keyIndex];
- beam.alpha = 1;
+ if (laserActive) return;
+ laserActive = true;
+ // Rastgele bir nota sesi çal
+ var soundIdx = Math.floor(Math.random() * noteSounds.length);
+ var noteSound = noteSounds[soundIdx];
+ if (LK.getSound && LK.getSound(noteSound.id)) {
+ LK.getSound(noteSound.id).play();
+ }
+ // Lazer ışığını yukarıya doğru uzat ve görünür yap
var originalHeight = beam.height;
- var extendedHeight = 800;
+ var extendedHeight = 2048; // Tüm yukarıya kadar uzasın
var originalY = beam.y;
+ beam.alpha = 1;
beam.height = extendedHeight;
beam.y = originalY - (extendedHeight - originalHeight) / 2;
- // O anda uzayan beam ile kesişen notaları yok et
- for (var n = notes.length - 1; n >= 0; n--) {
- var note = notes[n];
- if (!note.collected) {
- if (note.x + note.width / 2 >= beam.x - keyWidth / 2 && note.x - note.width / 2 <= beam.x + keyWidth / 2 && note.y + note.height / 2 >= beam.y - beam.height / 2 && note.y - note.height / 2 <= beam.y + beam.height / 2) {
- note.collected = true;
- // Skoru 10 artır
- LK.setScore(LK.getScore() + 10);
- scoreTxt.setText(LK.getScore());
- tween(note, {
- alpha: 0,
- scaleX: 1.5,
- scaleY: 1.5
- }, {
- duration: 120,
- easing: tween.easeOut,
- onFinish: function (note, n) {
- return function () {
- note.destroy();
- };
- }(note, n)
- });
- notes.splice(n, 1);
+ // Lazer aktifken sürekli notaları kontrol et
+ beam._laserInterval = LK.setInterval(function () {
+ for (var n = notes.length - 1; n >= 0; n--) {
+ var note = notes[n];
+ if (!note.collected) {
+ if (note.x + note.width / 2 >= beam.x - keyWidth / 2 && note.x - note.width / 2 <= beam.x + keyWidth / 2 && note.y + note.height / 2 >= beam.y - beam.height / 2 && note.y - note.height / 2 <= beam.y + beam.height / 2) {
+ note.collected = true;
+ tween(note, {
+ alpha: 0,
+ scaleX: 1.5,
+ scaleY: 1.5
+ }, {
+ duration: 120,
+ easing: tween.easeOut,
+ onFinish: function (note, n) {
+ return function () {
+ note.destroy();
+ };
+ }(note, n)
+ });
+ notes.splice(n, 1);
+ }
}
}
+ }, 30); // 30ms'de bir kontrol et
+ };
+ key.up = function (x, y, obj) {
+ if (!laserActive) return;
+ laserActive = false;
+ // Lazer ışığını animasyonla eski haline döndür
+ if (beam._laserInterval) {
+ LK.clearInterval(beam._laserInterval);
+ beam._laserInterval = null;
}
- // Beam'i animasyonla eski haline döndür (yükseklik ve y)
tween(beam, {
alpha: 0,
- height: originalHeight,
- y: originalY,
+ height: beamHeight,
+ y: beamY,
scaleY: 1
}, {
- duration: 250,
+ duration: 200,
easing: tween.easeOut
});
};
})(i);
@@ -270,45 +316,96 @@
for (var i = notes.length - 1; i >= 0; i--) {
var note = notes[i];
// Not güncelle
note.update();
- // Piyano tuşlarına değdi mi? (Yalnızca henüz toplanmamışsa)
- if (!note.collected && note.y + note.height / 2 >= keysY - keyHeight / 2) {
+ // Piyano tuşlarına değdi mi? (Yalnızca henüz toplanmamışsa ve nota henüz zemine değmemişse)
+ if (!note.collected && note.y + note.height / 2 >= keysY - keyHeight / 2 && note.y + note.height / 2 < keysY + keyHeight / 2 // Yani henüz zemine değmeden
+ ) {
+ var _loop = function _loop() {
+ key = keys[k];
+ if (note.x + note.width / 2 >= key.x - keyWidth / 2 && note.x - note.width / 2 <= key.x + keyWidth / 2) {
+ var animateScore = function animateScore(from, to) {
+ var scoreAnim = {
+ value: from
+ };
+ tween(scoreAnim, {
+ value: to
+ }, {
+ duration: 400,
+ easing: tween.easeOut,
+ onUpdate: function onUpdate() {
+ scoreTxt.setText(Math.floor(scoreAnim.value));
+ // Skor büyüt/küçült animasyonu
+ scoreTxt.scaleX = scoreTxt.scaleY = 1.15;
+ },
+ onFinish: function onFinish() {
+ scoreTxt.setText(to);
+ tween(scoreTxt, {
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 120,
+ easing: tween.easeOut
+ });
+ }
+ });
+ }; // 300 puana ulaşıldıysa oyunu kazan
+ // Notayı yakala
+ note.collected = true;
+ // Skoru artır (her zaman 10x ekle)
+ prevScore = LK.getScore();
+ newScore = prevScore + 10 * 10; // Her nota için 10x puan ekle
+ LK.setScore(newScore);
+ animateScore(prevScore, newScore);
+ if (LK.getScore() >= 300) {
+ LK.showYouWin();
+ }
+ // Kısa bir animasyonla kaybolsun
+ tween(note, {
+ alpha: 0,
+ scaleX: 1.5,
+ scaleY: 1.5
+ }, {
+ duration: 200,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ note.destroy();
+ }
+ });
+ notes.splice(i, 1);
+ return 1; // break
+ }
+ },
+ key,
+ prevScore,
+ newScore;
// Beyaz tuşlardan birine denk geliyorsa yakalandı say
for (var k = 0; k < keyCount; k++) {
- var key = keys[k];
- if (note.x + note.width / 2 >= key.x - keyWidth / 2 && note.x - note.width / 2 <= key.x + keyWidth / 2) {
- // Notayı yakala
- note.collected = true;
- // Skoru artır
- LK.setScore(LK.getScore() + 10);
- scoreTxt.setText(LK.getScore());
- // 300 puana ulaşıldıysa oyunu kazan
- if (LK.getScore() >= 300) {
- LK.showYouWin();
- }
- // Kısa bir animasyonla kaybolsun
- tween(note, {
- alpha: 0,
- scaleX: 1.5,
- scaleY: 1.5
- }, {
- duration: 200,
- easing: tween.easeOut,
- onFinish: function onFinish() {
- note.destroy();
- }
- });
- notes.splice(i, 1);
- break;
- }
+ if (_loop()) break;
}
continue;
}
// Ekranın dışına çıktıysa veya toplandıysa sil
- if (note.y - note.height / 2 > 2732 + 50 || note.collected) {
+ if (note.y - note.height / 2 > 2732 + 50) {
+ // Nota kaçtıysa can azalt
+ if (!note.collected) {
+ lifeCount--;
+ updateCanBar();
+ // Can ikonlarını güncelle (görsel olarak sil)
+ if (lifeIcons[lifeCount]) {
+ lifeIcons[lifeCount].alpha = 0.2;
+ }
+ // Can bitti mi?
+ if (lifeCount <= 0) {
+ LK.showGameOver();
+ return;
+ }
+ }
note.destroy();
notes.splice(i, 1);
+ } else if (note.collected) {
+ note.destroy();
+ notes.splice(i, 1);
}
}
};
// Oyun sıfırlanırken zamanlayıcıyı temizle
@@ -316,8 +413,15 @@
if (noteTimer) LK.clearTimeout(noteTimer);
// Müziği durdur
LK.stopMusic();
};
+// Skor değiştiğinde skor panosunu güncelle (her durumda güncel tut)
+LK.on('score', function (newScore) {
+ // Skor animasyonu başka yerde çalışıyorsa, burada sadece güncel tut
+ if (!scoreTxt._isAnimating) {
+ scoreTxt.setText(newScore);
+ }
+});
// Oyun başladığında ilk skor sıfırlansın
// LK.setScore(0);
// scoreTxt.setText('0');
// Oyun alanında başka bir şey yok, sadece notalar ve skor var.
\ No newline at end of file
Arkaplanı kaldır
arkaplan temizle
arkaplan temizle
meme silah uzatan kedi. In-Game asset. 2d. High contrast. No shadows
regular show modecaı. In-Game asset. 2d. High contrast. No shadows
kaka yüzü. In-Game asset. 2d. High contrast. No shadows
kalp. In-Game asset. 2d. High contrast. No shadows
meme chill guy face. In-Game asset. 2d. High contrast. No shadows
minecraft chiken jokey. In-Game asset. 2d. High contrast. No shadows
halay çeken insan. In-Game asset. 2d. High contrast. No shadows