/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var FallingBomb = Container.expand(function (lane) { var self = Container.call(this); var bombGraphics = self.attachAsset('bomb', { anchorX: 0.5, anchorY: 0.5 }); self.lane = lane; self.speed = 8; self.update = function () { self.y += self.speed; }; return self; }); var FallingNote = Container.expand(function (noteType, lane) { var self = Container.call(this); var noteGraphics = self.attachAsset('note' + noteType, { anchorX: 0.5, anchorY: 0.5 }); self.lane = lane; self.speed = 8; self.noteType = noteType; self.update = function () { self.y += self.speed; }; return self; }); var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); self.currentLane = 3; self.shieldActive = false; self.shieldTimer = 0; self.shieldEffect = null; self.update = function () { if (self.shieldActive) { self.shieldTimer--; // Update shield effect position to follow player if (self.shieldEffect) { self.shieldEffect.x = self.x; self.shieldEffect.y = self.y; } if (self.shieldTimer <= 0) { self.shieldActive = false; playerGraphics.tint = 0xFFFFFF; shieldUI.container.visible = false; // Remove shield effect when shield ends if (self.shieldEffect) { self.shieldEffect.destroy(); self.shieldEffect = null; } } else { // Update shield timer bar var progress = self.shieldTimer / 300; // 300 is max shield time shieldUI.barFg.width = 300 * progress; } } else { shieldUI.container.visible = false; } }; self.activateShield = function () { self.shieldActive = true; self.shieldTimer = 300; // 5 seconds at 60fps playerGraphics.tint = 0xFFD700; shieldUI.container.visible = true; shieldUI.barFg.width = 300; // Remove any existing shield effect first if (self.shieldEffect) { self.shieldEffect.destroy(); self.shieldEffect = null; } // Create shield activation effect that persists only when shield is active if (self.shieldActive) { self.shieldEffect = new ShieldEffect(); self.shieldEffect.x = self.x; self.shieldEffect.y = self.y; game.addChild(self.shieldEffect); self.shieldEffect.startEffect(); } }; return self; }); var ShieldEffect = Container.expand(function () { var self = Container.call(this); var effectGraphics = self.attachAsset('shieldEffect', { anchorX: 0.5, anchorY: 0.5 }); effectGraphics.alpha = 0.7; effectGraphics.scaleX = 1.2; effectGraphics.scaleY = 1.2; self.animationDirection = 1; self.update = function () { // Continuous pulsing animation while shield is active effectGraphics.rotation += 0.05; effectGraphics.scaleX += 0.01 * self.animationDirection; effectGraphics.scaleY += 0.01 * self.animationDirection; if (effectGraphics.scaleX >= 1.4) { self.animationDirection = -1; } else if (effectGraphics.scaleX <= 1.0) { self.animationDirection = 1; } }; self.startEffect = function () { // Initial pulse effect tween(effectGraphics, { alpha: 0.7 }, { duration: 300, easing: tween.easeOut }); }; return self; }); var ShieldPowerup = Container.expand(function (lane) { var self = Container.call(this); var shieldGraphics = self.attachAsset('shield', { anchorX: 0.5, anchorY: 0.5 }); self.lane = lane; self.speed = 6; self.update = function () { self.y += self.speed; shieldGraphics.rotation += 0.1; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x2C3E50 }); /**** * Game Code ****/ var player; var staircases = []; var fallingNotes = []; var fallingBombs = []; var shieldPowerups = []; var hearts = []; var scoreTxt; var heartsTxt; var shieldUI = {}; var playerHealth = 3; var gameSpeed = 1; var spawnTimer = 0; var bombSpawnChance = 0.15; var shieldSpawnChance = 0.05; var shieldSpawned = false; var musicStarted = false; var lanePositions = []; var laneWidth = 2048 / 7; // Calculate lane positions for (var i = 0; i < 7; i++) { lanePositions[i] = i * laneWidth + laneWidth / 2; } // Create staircases for (var i = 0; i < 7; i++) { var staircase = game.addChild(LK.getAsset('staircase', { anchorX: 0.5, anchorY: 0.5 })); staircase.x = lanePositions[i]; staircase.y = 2732 - 100; staircase.width = laneWidth - 20; // Make each staircase fit its lane with small gap staircase.height = 2000; // Set appropriate height for individual staircases (1000% increase) staircases.push(staircase); } // Create tunnel at top var tunnel = game.addChild(LK.getAsset('tunnel', { anchorX: 0.5, anchorY: 1 })); tunnel.x = 2048 / 2; tunnel.y = 200; // Create player player = game.addChild(new Player()); player.x = lanePositions[player.currentLane]; player.y = 2732 - 100 - 740; // Position player lower on the staircase // Create UI scoreTxt = new Text2('Score: 0', { size: 80, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); heartsTxt = new Text2('♥ ♥ ♥', { size: 80, fill: 0xFF0000 }); heartsTxt.anchor.set(1, 0); LK.gui.topRight.addChild(heartsTxt); // Create shield UI shieldUI.container = new Container(); shieldUI.container.visible = false; LK.gui.topRight.addChild(shieldUI.container); shieldUI.text = new Text2('SHIELD', { size: 80, fill: 0xFFD700 }); shieldUI.text.anchor.set(1, 0); shieldUI.text.x = 0; shieldUI.text.y = 100; shieldUI.container.addChild(shieldUI.text); // Shield timer bar background shieldUI.barBg = LK.getAsset('staircase', { anchorX: 1, anchorY: 0 }); shieldUI.barBg.x = 0; shieldUI.barBg.y = 180; shieldUI.barBg.width = 300; shieldUI.barBg.height = 30; shieldUI.barBg.tint = 0x333333; shieldUI.container.addChild(shieldUI.barBg); // Shield timer bar foreground shieldUI.barFg = LK.getAsset('staircase', { anchorX: 1, anchorY: 0 }); shieldUI.barFg.x = 0; shieldUI.barFg.y = 180; shieldUI.barFg.width = 300; shieldUI.barFg.height = 30; shieldUI.barFg.tint = 0xFF0000; shieldUI.container.addChild(shieldUI.barFg); function updateHeartsDisplay() { var heartsText = ''; for (var i = 0; i < playerHealth; i++) { heartsText += '♥ '; } heartsTxt.setText(heartsText); } function spawnFallingObject() { var lane = Math.floor(Math.random() * 7); var x = lanePositions[lane]; var spawnY = 150; // Spawn from bottom of tunnel if (Math.random() < shieldSpawnChance && !shieldSpawned) { // Spawn shield powerup var shield = new ShieldPowerup(lane); shield.x = x; shield.y = spawnY; shieldPowerups.push(shield); game.addChild(shield); shieldSpawned = true; } else if (Math.random() < bombSpawnChance) { // Spawn bomb var bomb = new FallingBomb(lane); bomb.x = x; bomb.y = spawnY; fallingBombs.push(bomb); game.addChild(bomb); } else { // Spawn note var noteType = Math.floor(Math.random() * 7) + 1; var note = new FallingNote(noteType, lane); note.x = x; note.y = spawnY; fallingNotes.push(note); game.addChild(note); } } function movePlayer(targetLane) { if (targetLane >= 0 && targetLane < 7) { player.currentLane = targetLane; tween(player, { x: lanePositions[targetLane] }, { duration: 200, easing: tween.easeOut }); } } game.down = function (x, y, obj) { var clickedLane = Math.floor(x / laneWidth); movePlayer(clickedLane); }; game.update = function () { // Spawn falling objects spawnTimer++; if (spawnTimer >= Math.max(30 - Math.floor(LK.ticks / 600), 15)) { spawnFallingObject(); spawnTimer = 0; } // Update and check falling notes for (var i = fallingNotes.length - 1; i >= 0; i--) { var note = fallingNotes[i]; if (note.lastY === undefined) note.lastY = note.y; // Check if note went off screen if (note.lastY < 2732 && note.y >= 2732) { note.destroy(); fallingNotes.splice(i, 1); continue; } // Check collision with player if (note.lane === player.currentLane && note.intersects(player)) { LK.setScore(LK.getScore() + 10); scoreTxt.setText('Score: ' + LK.getScore()); LK.getSound('catch').play(); // Start music when first note is caught if (!musicStarted) { LK.playMusic('background_music'); musicStarted = true; } note.destroy(); fallingNotes.splice(i, 1); continue; } note.lastY = note.y; } // Update and check falling bombs for (var i = fallingBombs.length - 1; i >= 0; i--) { var bomb = fallingBombs[i]; if (bomb.lastY === undefined) bomb.lastY = bomb.y; // Check if bomb went off screen if (bomb.lastY < 2732 && bomb.y >= 2732) { bomb.destroy(); fallingBombs.splice(i, 1); continue; } // Check collision with player if (bomb.lane === player.currentLane && bomb.intersects(player)) { if (player.shieldActive) { // Bomb hits shield - create explosion effect LK.getSound('bomb_hit').play(); LK.effects.flashScreen(0xFFD700, 300); // Create explosion effect using tween var explosionScale = { scale: 1 }; tween(explosionScale, { scale: 3 }, { duration: 500, easing: tween.easeOut, onFinish: function onFinish() { // Explosion animation complete } }); // Tint bomb red and fade out for explosion effect tween(bomb, { alpha: 0, scaleX: 2, scaleY: 2 }, { duration: 300, easing: tween.easeOut }); } else { // Bomb hits player without shield playerHealth--; updateHeartsDisplay(); LK.getSound('bomb_hit').play(); LK.effects.flashScreen(0xff0000, 500); } bomb.destroy(); fallingBombs.splice(i, 1); if (playerHealth <= 0) { // Make player bounce and fall when losing tween(player, { y: player.y - 200 }, { duration: 400, easing: tween.easeOut, onFinish: function onFinish() { // After jumping up, fall down tween(player, { y: player.y + 400 }, { duration: 600, easing: tween.bounceIn, onFinish: function onFinish() { LK.showGameOver(); } }); } }); } continue; } bomb.lastY = bomb.y; } // Update and check shield powerups for (var i = shieldPowerups.length - 1; i >= 0; i--) { var shield = shieldPowerups[i]; if (shield.lastY === undefined) shield.lastY = shield.y; // Check if shield went off screen if (shield.lastY < 2732 && shield.y >= 2732) { shield.destroy(); shieldPowerups.splice(i, 1); shieldSpawned = false; continue; } // Check collision with player if (shield.lane === player.currentLane && shield.intersects(player) && !player.shieldActive) { player.activateShield(); LK.getSound('shield_pickup').play(); shield.destroy(); shieldPowerups.splice(i, 1); shieldSpawned = false; continue; } shield.lastY = shield.y; } // Gradually increase game speed if (LK.ticks % 1800 === 0) { // Every 30 seconds gameSpeed += 0.1; for (var i = 0; i < fallingNotes.length; i++) { fallingNotes[i].speed = 8 * gameSpeed; } for (var i = 0; i < fallingBombs.length; i++) { fallingBombs[i].speed = 8 * gameSpeed; } for (var i = 0; i < shieldPowerups.length; i++) { shieldPowerups[i].speed = 6 * gameSpeed; } } };
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var FallingBomb = Container.expand(function (lane) {
var self = Container.call(this);
var bombGraphics = self.attachAsset('bomb', {
anchorX: 0.5,
anchorY: 0.5
});
self.lane = lane;
self.speed = 8;
self.update = function () {
self.y += self.speed;
};
return self;
});
var FallingNote = Container.expand(function (noteType, lane) {
var self = Container.call(this);
var noteGraphics = self.attachAsset('note' + noteType, {
anchorX: 0.5,
anchorY: 0.5
});
self.lane = lane;
self.speed = 8;
self.noteType = noteType;
self.update = function () {
self.y += self.speed;
};
return self;
});
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.attachAsset('player', {
anchorX: 0.5,
anchorY: 0.5
});
self.currentLane = 3;
self.shieldActive = false;
self.shieldTimer = 0;
self.shieldEffect = null;
self.update = function () {
if (self.shieldActive) {
self.shieldTimer--;
// Update shield effect position to follow player
if (self.shieldEffect) {
self.shieldEffect.x = self.x;
self.shieldEffect.y = self.y;
}
if (self.shieldTimer <= 0) {
self.shieldActive = false;
playerGraphics.tint = 0xFFFFFF;
shieldUI.container.visible = false;
// Remove shield effect when shield ends
if (self.shieldEffect) {
self.shieldEffect.destroy();
self.shieldEffect = null;
}
} else {
// Update shield timer bar
var progress = self.shieldTimer / 300; // 300 is max shield time
shieldUI.barFg.width = 300 * progress;
}
} else {
shieldUI.container.visible = false;
}
};
self.activateShield = function () {
self.shieldActive = true;
self.shieldTimer = 300; // 5 seconds at 60fps
playerGraphics.tint = 0xFFD700;
shieldUI.container.visible = true;
shieldUI.barFg.width = 300;
// Remove any existing shield effect first
if (self.shieldEffect) {
self.shieldEffect.destroy();
self.shieldEffect = null;
}
// Create shield activation effect that persists only when shield is active
if (self.shieldActive) {
self.shieldEffect = new ShieldEffect();
self.shieldEffect.x = self.x;
self.shieldEffect.y = self.y;
game.addChild(self.shieldEffect);
self.shieldEffect.startEffect();
}
};
return self;
});
var ShieldEffect = Container.expand(function () {
var self = Container.call(this);
var effectGraphics = self.attachAsset('shieldEffect', {
anchorX: 0.5,
anchorY: 0.5
});
effectGraphics.alpha = 0.7;
effectGraphics.scaleX = 1.2;
effectGraphics.scaleY = 1.2;
self.animationDirection = 1;
self.update = function () {
// Continuous pulsing animation while shield is active
effectGraphics.rotation += 0.05;
effectGraphics.scaleX += 0.01 * self.animationDirection;
effectGraphics.scaleY += 0.01 * self.animationDirection;
if (effectGraphics.scaleX >= 1.4) {
self.animationDirection = -1;
} else if (effectGraphics.scaleX <= 1.0) {
self.animationDirection = 1;
}
};
self.startEffect = function () {
// Initial pulse effect
tween(effectGraphics, {
alpha: 0.7
}, {
duration: 300,
easing: tween.easeOut
});
};
return self;
});
var ShieldPowerup = Container.expand(function (lane) {
var self = Container.call(this);
var shieldGraphics = self.attachAsset('shield', {
anchorX: 0.5,
anchorY: 0.5
});
self.lane = lane;
self.speed = 6;
self.update = function () {
self.y += self.speed;
shieldGraphics.rotation += 0.1;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x2C3E50
});
/****
* Game Code
****/
var player;
var staircases = [];
var fallingNotes = [];
var fallingBombs = [];
var shieldPowerups = [];
var hearts = [];
var scoreTxt;
var heartsTxt;
var shieldUI = {};
var playerHealth = 3;
var gameSpeed = 1;
var spawnTimer = 0;
var bombSpawnChance = 0.15;
var shieldSpawnChance = 0.05;
var shieldSpawned = false;
var musicStarted = false;
var lanePositions = [];
var laneWidth = 2048 / 7;
// Calculate lane positions
for (var i = 0; i < 7; i++) {
lanePositions[i] = i * laneWidth + laneWidth / 2;
}
// Create staircases
for (var i = 0; i < 7; i++) {
var staircase = game.addChild(LK.getAsset('staircase', {
anchorX: 0.5,
anchorY: 0.5
}));
staircase.x = lanePositions[i];
staircase.y = 2732 - 100;
staircase.width = laneWidth - 20; // Make each staircase fit its lane with small gap
staircase.height = 2000; // Set appropriate height for individual staircases (1000% increase)
staircases.push(staircase);
}
// Create tunnel at top
var tunnel = game.addChild(LK.getAsset('tunnel', {
anchorX: 0.5,
anchorY: 1
}));
tunnel.x = 2048 / 2;
tunnel.y = 200;
// Create player
player = game.addChild(new Player());
player.x = lanePositions[player.currentLane];
player.y = 2732 - 100 - 740; // Position player lower on the staircase
// Create UI
scoreTxt = new Text2('Score: 0', {
size: 80,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
heartsTxt = new Text2('♥ ♥ ♥', {
size: 80,
fill: 0xFF0000
});
heartsTxt.anchor.set(1, 0);
LK.gui.topRight.addChild(heartsTxt);
// Create shield UI
shieldUI.container = new Container();
shieldUI.container.visible = false;
LK.gui.topRight.addChild(shieldUI.container);
shieldUI.text = new Text2('SHIELD', {
size: 80,
fill: 0xFFD700
});
shieldUI.text.anchor.set(1, 0);
shieldUI.text.x = 0;
shieldUI.text.y = 100;
shieldUI.container.addChild(shieldUI.text);
// Shield timer bar background
shieldUI.barBg = LK.getAsset('staircase', {
anchorX: 1,
anchorY: 0
});
shieldUI.barBg.x = 0;
shieldUI.barBg.y = 180;
shieldUI.barBg.width = 300;
shieldUI.barBg.height = 30;
shieldUI.barBg.tint = 0x333333;
shieldUI.container.addChild(shieldUI.barBg);
// Shield timer bar foreground
shieldUI.barFg = LK.getAsset('staircase', {
anchorX: 1,
anchorY: 0
});
shieldUI.barFg.x = 0;
shieldUI.barFg.y = 180;
shieldUI.barFg.width = 300;
shieldUI.barFg.height = 30;
shieldUI.barFg.tint = 0xFF0000;
shieldUI.container.addChild(shieldUI.barFg);
function updateHeartsDisplay() {
var heartsText = '';
for (var i = 0; i < playerHealth; i++) {
heartsText += '♥ ';
}
heartsTxt.setText(heartsText);
}
function spawnFallingObject() {
var lane = Math.floor(Math.random() * 7);
var x = lanePositions[lane];
var spawnY = 150; // Spawn from bottom of tunnel
if (Math.random() < shieldSpawnChance && !shieldSpawned) {
// Spawn shield powerup
var shield = new ShieldPowerup(lane);
shield.x = x;
shield.y = spawnY;
shieldPowerups.push(shield);
game.addChild(shield);
shieldSpawned = true;
} else if (Math.random() < bombSpawnChance) {
// Spawn bomb
var bomb = new FallingBomb(lane);
bomb.x = x;
bomb.y = spawnY;
fallingBombs.push(bomb);
game.addChild(bomb);
} else {
// Spawn note
var noteType = Math.floor(Math.random() * 7) + 1;
var note = new FallingNote(noteType, lane);
note.x = x;
note.y = spawnY;
fallingNotes.push(note);
game.addChild(note);
}
}
function movePlayer(targetLane) {
if (targetLane >= 0 && targetLane < 7) {
player.currentLane = targetLane;
tween(player, {
x: lanePositions[targetLane]
}, {
duration: 200,
easing: tween.easeOut
});
}
}
game.down = function (x, y, obj) {
var clickedLane = Math.floor(x / laneWidth);
movePlayer(clickedLane);
};
game.update = function () {
// Spawn falling objects
spawnTimer++;
if (spawnTimer >= Math.max(30 - Math.floor(LK.ticks / 600), 15)) {
spawnFallingObject();
spawnTimer = 0;
}
// Update and check falling notes
for (var i = fallingNotes.length - 1; i >= 0; i--) {
var note = fallingNotes[i];
if (note.lastY === undefined) note.lastY = note.y;
// Check if note went off screen
if (note.lastY < 2732 && note.y >= 2732) {
note.destroy();
fallingNotes.splice(i, 1);
continue;
}
// Check collision with player
if (note.lane === player.currentLane && note.intersects(player)) {
LK.setScore(LK.getScore() + 10);
scoreTxt.setText('Score: ' + LK.getScore());
LK.getSound('catch').play();
// Start music when first note is caught
if (!musicStarted) {
LK.playMusic('background_music');
musicStarted = true;
}
note.destroy();
fallingNotes.splice(i, 1);
continue;
}
note.lastY = note.y;
}
// Update and check falling bombs
for (var i = fallingBombs.length - 1; i >= 0; i--) {
var bomb = fallingBombs[i];
if (bomb.lastY === undefined) bomb.lastY = bomb.y;
// Check if bomb went off screen
if (bomb.lastY < 2732 && bomb.y >= 2732) {
bomb.destroy();
fallingBombs.splice(i, 1);
continue;
}
// Check collision with player
if (bomb.lane === player.currentLane && bomb.intersects(player)) {
if (player.shieldActive) {
// Bomb hits shield - create explosion effect
LK.getSound('bomb_hit').play();
LK.effects.flashScreen(0xFFD700, 300);
// Create explosion effect using tween
var explosionScale = {
scale: 1
};
tween(explosionScale, {
scale: 3
}, {
duration: 500,
easing: tween.easeOut,
onFinish: function onFinish() {
// Explosion animation complete
}
});
// Tint bomb red and fade out for explosion effect
tween(bomb, {
alpha: 0,
scaleX: 2,
scaleY: 2
}, {
duration: 300,
easing: tween.easeOut
});
} else {
// Bomb hits player without shield
playerHealth--;
updateHeartsDisplay();
LK.getSound('bomb_hit').play();
LK.effects.flashScreen(0xff0000, 500);
}
bomb.destroy();
fallingBombs.splice(i, 1);
if (playerHealth <= 0) {
// Make player bounce and fall when losing
tween(player, {
y: player.y - 200
}, {
duration: 400,
easing: tween.easeOut,
onFinish: function onFinish() {
// After jumping up, fall down
tween(player, {
y: player.y + 400
}, {
duration: 600,
easing: tween.bounceIn,
onFinish: function onFinish() {
LK.showGameOver();
}
});
}
});
}
continue;
}
bomb.lastY = bomb.y;
}
// Update and check shield powerups
for (var i = shieldPowerups.length - 1; i >= 0; i--) {
var shield = shieldPowerups[i];
if (shield.lastY === undefined) shield.lastY = shield.y;
// Check if shield went off screen
if (shield.lastY < 2732 && shield.y >= 2732) {
shield.destroy();
shieldPowerups.splice(i, 1);
shieldSpawned = false;
continue;
}
// Check collision with player
if (shield.lane === player.currentLane && shield.intersects(player) && !player.shieldActive) {
player.activateShield();
LK.getSound('shield_pickup').play();
shield.destroy();
shieldPowerups.splice(i, 1);
shieldSpawned = false;
continue;
}
shield.lastY = shield.y;
}
// Gradually increase game speed
if (LK.ticks % 1800 === 0) {
// Every 30 seconds
gameSpeed += 0.1;
for (var i = 0; i < fallingNotes.length; i++) {
fallingNotes[i].speed = 8 * gameSpeed;
}
for (var i = 0; i < fallingBombs.length; i++) {
fallingBombs[i].speed = 8 * gameSpeed;
}
for (var i = 0; i < shieldPowerups.length; i++) {
shieldPowerups[i].speed = 6 * gameSpeed;
}
}
};
2D metal golgesiz merdiven. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
2D golgesiz guclu bomba resimi. In-Game asset. 2d. High contrast. No shadows
2D golgesiz mavi renkte panelli fantastik holografik bir kalkan. In-Game asset. 2d. High contrast. No shadows
2D sari seffaf golgesiz panelli fantastik bir kure. In-Game asset. 2d. High contrast. No shadows
2D muzik notasi. In-Game asset. 2d. High contrast. No shadows
2D muzik notasi. In-Game asset. 2d. High contrast. No shadows
2D muzik notasi. In-Game asset. 2d. High contrast. No shadows
2D muzik notasi. In-Game asset. 2d. High contrast. No shadows
2D muzik notasi. In-Game asset. 2d. High contrast. No shadows
2D muzik notasi. In-Game asset. 2d. High contrast. No shadows
2D muzik yalniz notasi. In-Game asset. 2d. High contrast. No shadows
2d. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
2D bir yere tirmanamak isteyen elleri ve kollari acik pixelart bir insan. In-Game asset. 2d. High contrast. No shadows