User prompt
notalarin dustugu tepeye asagi donuk bir tunel yap ve notalar bundan dussun
Code edit (1 edits merged)
Please save this source code
User prompt
Stair Note Catcher
Initial prompt
oyuncu var ver asagidaki merdivenler ile yukaridan gelen notalari yakalamaya calisacak.toplam 7 farkli nota olacak ve 7 sira olacak.asagida ise 7 sira merdiven olacak oyucu sag sol yaparak merdivenler ile nota toplayacak,oyuncunun 3 kalbi olacak.aralarda bombalar gelecek ve oyuncu bombalara degerse 1 kalbi gidecek ve hic kalbi kalmazsa oyunu kaybedecek.oyunda skor tablosu olacak.ve ozel shieldi alarsa kisa sureligine kalkan kazanacak,kalkan sayeside bombalar oyuncuyu etkileyemeyecek.
/**** * 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.update = function () { if (self.shieldActive) { self.shieldTimer--; if (self.shieldTimer <= 0) { self.shieldActive = false; playerGraphics.tint = 0xFFFFFF; } } }; self.activateShield = function () { self.shieldActive = true; self.shieldTimer = 300; // 5 seconds at 60fps playerGraphics.tint = 0xFFD700; }; 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 playerHealth = 3; var gameSpeed = 1; var spawnTimer = 0; var bombSpawnChance = 0.15; var shieldSpawnChance = 0.05; 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; 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 - 150; // 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); 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) { // Spawn shield powerup var shield = new ShieldPowerup(lane); shield.x = x; shield.y = spawnY; shieldPowerups.push(shield); game.addChild(shield); } 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(); 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) && !player.shieldActive) { playerHealth--; updateHeartsDisplay(); LK.getSound('bomb_hit').play(); LK.effects.flashScreen(0xff0000, 500); bomb.destroy(); fallingBombs.splice(i, 1); if (playerHealth <= 0) { 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); continue; } // Check collision with player if (shield.lane === player.currentLane && shield.intersects(player)) { player.activateShield(); LK.getSound('shield_pickup').play(); shield.destroy(); shieldPowerups.splice(i, 1); 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; } } };
===================================================================
--- original.js
+++ change.js
@@ -111,8 +111,15 @@
staircase.x = lanePositions[i];
staircase.y = 2732 - 100;
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 - 150;
@@ -138,28 +145,29 @@
}
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) {
// Spawn shield powerup
var shield = new ShieldPowerup(lane);
shield.x = x;
- shield.y = -50;
+ shield.y = spawnY;
shieldPowerups.push(shield);
game.addChild(shield);
} else if (Math.random() < bombSpawnChance) {
// Spawn bomb
var bomb = new FallingBomb(lane);
bomb.x = x;
- bomb.y = -50;
+ 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 = -50;
+ note.y = spawnY;
fallingNotes.push(note);
game.addChild(note);
}
}
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