/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
// Müzik parçası (düşen kutu) sınıfı
var MusicNote = Container.expand(function (assetType) {
var self = Container.call(this);
// Asseti ekle ve ortala, parametreye göre asset seç
var note = self.attachAsset(assetType || 'musicNote', {
anchorX: 0.5,
anchorY: 0.5
});
// Hız (zorluk moduna göre ayarlanır)
self.speed = typeof noteSpeed !== 'undefined' ? noteSpeed : 18;
// 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) {
// Sadece ilk tıklamada çalışsın
if (self.collected) return;
self.collected = true;
// Skoru artır
LK.setScore(LK.getScore() + 10);
scoreTxt.setText(LK.getScore());
// Toplama sesi çal
LK.getSound('collect').play();
// 300 puana ulaşıldıysa nice sesi çal
if (LK.getScore() >= 300 && LK.getScore() < 310) {
LK.getSound('nice').play();
}
// 500 puana ulaşıldıysa oyunu kazan
if (LK.getScore() >= 500) {
LK.getSound('nice').play();
LK.showYouWin();
}
self.destroy();
// Diziden silinecek, ana döngüde
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x181818
});
/****
* Game Code
****/
// Oyun alanında başka bir şey yok, sadece notalar ve skor var.;
// Can barı (3 top asseti) - sağ üst köşe
var lifeIcons = [];
var playerLives = 3;
for (var i = 0; i < 3; i++) {
var icon = LK.getAsset('top', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.5,
scaleY: 1.5
});
// Sağ üstte konumlandır, sol tarafa doğru sırala
icon.x = -120 - i * 120;
icon.y = 120;
icon.visible = true;
LK.gui.topRight.addChild(icon);
lifeIcons.push(icon);
}
var background = LK.getAsset('background', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 / 2,
scaleX: 1,
scaleY: 1
});
game.addChild(background);
// Menü başlığı (ilk ekranda sadece bu görünsün)
var startMsg = new Text2('Menü', {
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;
var startAfterDiffMsg = undefined;
// Zorluk modları: kolay, normal, zor
var difficulty = null;
var noteSpeed = 18; // default
// minInterval ve maxInterval zorluk seçimine göre ayarlanacak
// Zorluk seçimi için mesajlar
var easyBtn = new Text2('Kolay', {
size: 100,
fill: 0x00FF00,
align: 'center'
});
easyBtn.anchor.set(0.5, 0.5);
easyBtn.x = 2048 / 2 - 350;
easyBtn.y = 2732 / 2 + 250;
var normalBtn = new Text2('Normal', {
size: 100,
fill: 0xFFFF00,
align: 'center'
});
normalBtn.anchor.set(0.5, 0.5);
normalBtn.x = 2048 / 2;
normalBtn.y = 2732 / 2 + 250;
var hardBtn = new Text2('Zor', {
size: 100,
fill: 0xFF0000,
align: 'center'
});
hardBtn.anchor.set(0.5, 0.5);
hardBtn.x = 2048 / 2 + 350;
hardBtn.y = 2732 / 2 + 250;
game.addChild(easyBtn);
game.addChild(normalBtn);
game.addChild(hardBtn);
// Zorluk seçimi fonksiyonu
function selectDifficulty(mode) {
if (gameStarted) return;
difficulty = mode;
// Hız ve interval ayarları
if (mode === 'easy') {
noteSpeed = 18 * 0.5;
minInterval = 500;
maxInterval = 1200;
} else if (mode === 'normal') {
noteSpeed = 18 * 0.65;
minInterval = 250;
maxInterval = 600;
} else if (mode === 'hard') {
noteSpeed = 18 * 0.85;
// Zor modda notalar biraz daha az gelsin
minInterval = 220;
maxInterval = 500;
}
// Butonları kaldır
if (easyBtn.parent) easyBtn.parent.removeChild(easyBtn);
if (normalBtn.parent) normalBtn.parent.removeChild(normalBtn);
if (hardBtn.parent) hardBtn.parent.removeChild(hardBtn);
// Menü başlığını kaldır
if (startMsg && startMsg.parent) startMsg.parent.removeChild(startMsg);
// Yeni: Başlamak için dokunun mesajı göster ve oyunu başlatmak için dokunuş bekle
if (typeof startAfterDiffMsg !== "undefined" && startAfterDiffMsg.parent) {
startAfterDiffMsg.parent.removeChild(startAfterDiffMsg);
}
startAfterDiffMsg = new Text2('Başlamak için dokunun', {
size: 120,
fill: 0xFFD700,
align: 'center'
});
startAfterDiffMsg.anchor.set(0.5, 0.5);
startAfterDiffMsg.x = 2048 / 2;
startAfterDiffMsg.y = 2732 / 2;
game.addChild(startAfterDiffMsg);
// Geçici olarak dokunma handlerı ekle
game.down = function (x, y, obj) {
if (startAfterDiffMsg && startAfterDiffMsg.parent) {
startAfterDiffMsg.parent.removeChild(startAfterDiffMsg);
}
// Oyun başlatılsın
startGame();
// Oyun başladıktan sonra dokunma handlerını kaldır
game.down = function (x, y, obj) {};
};
}
// Butonlara dokunma olayları
easyBtn.down = function (x, y, obj) {
selectDifficulty('easy');
};
normalBtn.down = function (x, y, obj) {
selectDifficulty('normal');
};
hardBtn.down = function (x, y, obj) {
selectDifficulty('hard');
};
// Not ve zamanlayıcıyı başlatan fonksiyon
function startGame() {
if (gameStarted) return;
gameStarted = true;
LK.setScore(0);
scoreTxt.setText('0');
missedNotes = 0;
playerLives = 3;
// Tüm can ikonlarını görünür yap
for (var i = 0; i < lifeIcons.length; i++) {
lifeIcons[i].visible = true;
}
// 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) {
// Artık ilk dokunuşta oyun başlamıyor, zorluk seçimiyle başlıyor
};
// 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,
fill: 0xFFD700,
align: 'center'
});
scoreLabel.anchor.set(0.5, 1);
LK.gui.top.addChild(scoreLabel);
scoreLabel.y = 80;
var scoreTxt = new Text2('0', {
size: 120,
fill: 0xFFFFFF
});
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;
// Düşen notaların tutulduğu dizi
var notes = [];
// Kaçırılan nota sayısı
var missedNotes = 0;
// Yeni nota oluşturma fonksiyonu
function spawnNote() {
// Rastgele bir nota asseti seç (dokuz seçenek)
var noteTypes = ['musicNote', 'musicNote2', 'musicNote3', 'musicNote4', 'musicNote5', 'musicNote6', 'musicNote7', 'musicNote8', 'musicNote9'];
var noteType = noteTypes[Math.floor(Math.random() * noteTypes.length)];
var note = new MusicNote(noteType);
note.speed = typeof noteSpeed !== 'undefined' ? noteSpeed : 18;
// 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();
// Ekranın dışına çıktıysa veya toplandıysa sil
if (note.y - note.height / 2 > 2732 + 50 || note.collected) {
// Eğer kaçırıldıysa ve toplanmadıysa, kaçırılanları say
if (!note.collected && note.y - note.height / 2 > 2732 + 50) {
missedNotes++;
playerLives--;
// Can kaybetme sesi çal
LK.getSound('lifeSound').play();
// Can ikonunu gizle
if (playerLives >= 0 && playerLives < lifeIcons.length) {
lifeIcons[playerLives].visible = false;
}
// 3 nota kaçırılırsa oyunu bitir
if (missedNotes >= 3) {
LK.getSound('viliVili').play();
LK.showGameOver();
return;
}
}
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();
};
// 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. /****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
// Müzik parçası (düşen kutu) sınıfı
var MusicNote = Container.expand(function (assetType) {
var self = Container.call(this);
// Asseti ekle ve ortala, parametreye göre asset seç
var note = self.attachAsset(assetType || 'musicNote', {
anchorX: 0.5,
anchorY: 0.5
});
// Hız (zorluk moduna göre ayarlanır)
self.speed = typeof noteSpeed !== 'undefined' ? noteSpeed : 18;
// 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) {
// Sadece ilk tıklamada çalışsın
if (self.collected) return;
self.collected = true;
// Skoru artır
LK.setScore(LK.getScore() + 10);
scoreTxt.setText(LK.getScore());
// Toplama sesi çal
LK.getSound('collect').play();
// 300 puana ulaşıldıysa nice sesi çal
if (LK.getScore() >= 300 && LK.getScore() < 310) {
LK.getSound('nice').play();
}
// 500 puana ulaşıldıysa oyunu kazan
if (LK.getScore() >= 500) {
LK.getSound('nice').play();
LK.showYouWin();
}
self.destroy();
// Diziden silinecek, ana döngüde
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x181818
});
/****
* Game Code
****/
// Oyun alanında başka bir şey yok, sadece notalar ve skor var.;
// Can barı (3 top asseti) - sağ üst köşe
var lifeIcons = [];
var playerLives = 3;
for (var i = 0; i < 3; i++) {
var icon = LK.getAsset('top', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.5,
scaleY: 1.5
});
// Sağ üstte konumlandır, sol tarafa doğru sırala
icon.x = -120 - i * 120;
icon.y = 120;
icon.visible = true;
LK.gui.topRight.addChild(icon);
lifeIcons.push(icon);
}
var background = LK.getAsset('background', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 / 2,
scaleX: 1,
scaleY: 1
});
game.addChild(background);
// Menü başlığı (ilk ekranda sadece bu görünsün)
var startMsg = new Text2('Menü', {
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;
var startAfterDiffMsg = undefined;
// Zorluk modları: kolay, normal, zor
var difficulty = null;
var noteSpeed = 18; // default
// minInterval ve maxInterval zorluk seçimine göre ayarlanacak
// Zorluk seçimi için mesajlar
var easyBtn = new Text2('Kolay', {
size: 100,
fill: 0x00FF00,
align: 'center'
});
easyBtn.anchor.set(0.5, 0.5);
easyBtn.x = 2048 / 2 - 350;
easyBtn.y = 2732 / 2 + 250;
var normalBtn = new Text2('Normal', {
size: 100,
fill: 0xFFFF00,
align: 'center'
});
normalBtn.anchor.set(0.5, 0.5);
normalBtn.x = 2048 / 2;
normalBtn.y = 2732 / 2 + 250;
var hardBtn = new Text2('Zor', {
size: 100,
fill: 0xFF0000,
align: 'center'
});
hardBtn.anchor.set(0.5, 0.5);
hardBtn.x = 2048 / 2 + 350;
hardBtn.y = 2732 / 2 + 250;
game.addChild(easyBtn);
game.addChild(normalBtn);
game.addChild(hardBtn);
// Zorluk seçimi fonksiyonu
function selectDifficulty(mode) {
if (gameStarted) return;
difficulty = mode;
// Hız ve interval ayarları
if (mode === 'easy') {
noteSpeed = 18 * 0.5;
minInterval = 500;
maxInterval = 1200;
} else if (mode === 'normal') {
noteSpeed = 18 * 0.65;
minInterval = 250;
maxInterval = 600;
} else if (mode === 'hard') {
noteSpeed = 18 * 0.85;
// Zor modda notalar biraz daha az gelsin
minInterval = 220;
maxInterval = 500;
}
// Butonları kaldır
if (easyBtn.parent) easyBtn.parent.removeChild(easyBtn);
if (normalBtn.parent) normalBtn.parent.removeChild(normalBtn);
if (hardBtn.parent) hardBtn.parent.removeChild(hardBtn);
// Menü başlığını kaldır
if (startMsg && startMsg.parent) startMsg.parent.removeChild(startMsg);
// Yeni: Başlamak için dokunun mesajı göster ve oyunu başlatmak için dokunuş bekle
if (typeof startAfterDiffMsg !== "undefined" && startAfterDiffMsg.parent) {
startAfterDiffMsg.parent.removeChild(startAfterDiffMsg);
}
startAfterDiffMsg = new Text2('Başlamak için dokunun', {
size: 120,
fill: 0xFFD700,
align: 'center'
});
startAfterDiffMsg.anchor.set(0.5, 0.5);
startAfterDiffMsg.x = 2048 / 2;
startAfterDiffMsg.y = 2732 / 2;
game.addChild(startAfterDiffMsg);
// Geçici olarak dokunma handlerı ekle
game.down = function (x, y, obj) {
if (startAfterDiffMsg && startAfterDiffMsg.parent) {
startAfterDiffMsg.parent.removeChild(startAfterDiffMsg);
}
// Oyun başlatılsın
startGame();
// Oyun başladıktan sonra dokunma handlerını kaldır
game.down = function (x, y, obj) {};
};
}
// Butonlara dokunma olayları
easyBtn.down = function (x, y, obj) {
selectDifficulty('easy');
};
normalBtn.down = function (x, y, obj) {
selectDifficulty('normal');
};
hardBtn.down = function (x, y, obj) {
selectDifficulty('hard');
};
// Not ve zamanlayıcıyı başlatan fonksiyon
function startGame() {
if (gameStarted) return;
gameStarted = true;
LK.setScore(0);
scoreTxt.setText('0');
missedNotes = 0;
playerLives = 3;
// Tüm can ikonlarını görünür yap
for (var i = 0; i < lifeIcons.length; i++) {
lifeIcons[i].visible = true;
}
// 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) {
// Artık ilk dokunuşta oyun başlamıyor, zorluk seçimiyle başlıyor
};
// 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,
fill: 0xFFD700,
align: 'center'
});
scoreLabel.anchor.set(0.5, 1);
LK.gui.top.addChild(scoreLabel);
scoreLabel.y = 80;
var scoreTxt = new Text2('0', {
size: 120,
fill: 0xFFFFFF
});
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;
// Düşen notaların tutulduğu dizi
var notes = [];
// Kaçırılan nota sayısı
var missedNotes = 0;
// Yeni nota oluşturma fonksiyonu
function spawnNote() {
// Rastgele bir nota asseti seç (dokuz seçenek)
var noteTypes = ['musicNote', 'musicNote2', 'musicNote3', 'musicNote4', 'musicNote5', 'musicNote6', 'musicNote7', 'musicNote8', 'musicNote9'];
var noteType = noteTypes[Math.floor(Math.random() * noteTypes.length)];
var note = new MusicNote(noteType);
note.speed = typeof noteSpeed !== 'undefined' ? noteSpeed : 18;
// 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();
// Ekranın dışına çıktıysa veya toplandıysa sil
if (note.y - note.height / 2 > 2732 + 50 || note.collected) {
// Eğer kaçırıldıysa ve toplanmadıysa, kaçırılanları say
if (!note.collected && note.y - note.height / 2 > 2732 + 50) {
missedNotes++;
playerLives--;
// Can kaybetme sesi çal
LK.getSound('lifeSound').play();
// Can ikonunu gizle
if (playerLives >= 0 && playerLives < lifeIcons.length) {
lifeIcons[playerLives].visible = false;
}
// 3 nota kaçırılırsa oyunu bitir
if (missedNotes >= 3) {
LK.getSound('viliVili').play();
LK.showGameOver();
return;
}
}
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();
};
// 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.
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