Code edit (1 edits merged)
Please save this source code
User prompt
99 Balls - Ultimate Bubble Breaker
Initial prompt
Sıradan balon patlatma oyunlarından sıkıldınız mı? 99 Balls, Bubble Shooter ve Breakout oyunlarının oynanışını bir araya getiren yenilikçi bir oyun deneyimi sunuyor! Bu oyunda, numaralı topların ekranın altına ulaşmadan önce yok etmeniz gerekiyor. Her top, yok edilmesi için gereken vuruş sayısını gösteren bir numaraya sahiptir. Bir seferde fırlatabileceğiniz silah sayısını artırmak için daireleri toplayın. Yeni silahları açmak için yıldızları toplayın! Oyunda ilerledikçe, toplardaki numaralar da giderek yüksek hale gelir. İpucu: Silahınızı sadece tek bir topa yönlendirmek yerine, atış kılavuzunu kullanarak mümkün olduğunca fazla topa sektirmeye çalışın. Kaç aşamaya kadar hayatta kalabilirsiniz?
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var AimLine = Container.expand(function () { var self = Container.call(this); for (var i = 0; i < 10; i++) { var dot = self.attachAsset('aimline', { anchorX: 0.5, anchorY: 0.5, y: -i * 30, alpha: 0.5 - i * 0.05 }); } return self; }); var Ball = Container.expand(function () { var self = Container.call(this); var ballGraphics = self.attachAsset('ball', { anchorX: 0.5, anchorY: 0.5 }); self.numberText = new Text2('1', { size: 40, fill: 0xFFFFFF }); self.numberText.anchor.set(0.5, 0.5); self.addChild(self.numberText); self.hits = 1; self.radius = 40; self.velocityX = 0; self.velocityY = 0; self.setNumber = function (num) { self.hits = num; self.numberText.setText(num.toString()); var scale = 1 + num / 50 * 0.5; ballGraphics.scale.set(scale); self.radius = 40 * scale; }; self.takeDamage = function () { self.hits--; if (self.hits <= 0) { return true; } self.numberText.setText(self.hits.toString()); tween(ballGraphics, { scaleX: 0.8, scaleY: 0.8 }, { duration: 100, onFinish: function onFinish() { tween(ballGraphics, { scaleX: 1, scaleY: 1 }, { duration: 100 }); } }); return false; }; return self; }); var Cannon = Container.expand(function () { var self = Container.call(this); var cannonGraphics = self.attachAsset('cannon', { anchorX: 0.5, anchorY: 0.8 }); self.rotation = 0; return self; }); var PowerUp = Container.expand(function () { var self = Container.call(this); var powerupGraphics = self.attachAsset('powerup', { anchorX: 0.5, anchorY: 0.5 }); self.radius = 20; return self; }); var Projectile = Container.expand(function () { var self = Container.call(this); var projectileGraphics = self.attachAsset('projectile', { anchorX: 0.5, anchorY: 0.5 }); self.velocityX = 0; self.velocityY = 0; self.speed = 15; self.radius = 10; self.update = function () { self.x += self.velocityX; self.y += self.velocityY; if (self.x <= self.radius || self.x >= 2048 - self.radius) { self.velocityX *= -1; self.x = Math.max(self.radius, Math.min(2048 - self.radius, self.x)); } if (self.y <= self.radius) { self.velocityY *= -1; self.y = self.radius; } }; return self; }); var Star = Container.expand(function () { var self = Container.call(this); var starGraphics = self.attachAsset('star', { anchorX: 0.5, anchorY: 0.5 }); self.radius = 25; starGraphics.rotation = Math.PI / 4; self.update = function () { starGraphics.rotation += 0.02; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x2c3e50 }); /**** * Game Code ****/ var cannon; var aimLine; var balls = []; var projectiles = []; var powerups = []; var stars = []; var isAiming = false; var canShoot = true; var projectileCount = 1; var stage = 1; var ballsPerRow = 6; var ballSpeed = 0.5; var gameActive = true; var stageText = new Text2('Stage 1', { size: 60, fill: 0xFFFFFF }); stageText.anchor.set(0.5, 0); stageText.y = 20; LK.gui.top.addChild(stageText); var projectileCountText = new Text2('x1', { size: 50, fill: 0x4ECDC4 }); projectileCountText.anchor.set(0.5, 0); projectileCountText.y = 100; LK.gui.top.addChild(projectileCountText); var scoreText = new Text2('Score: 0', { size: 40, fill: 0xFFFFFF }); scoreText.anchor.set(1, 0); scoreText.x = -20; scoreText.y = 20; LK.gui.topRight.addChild(scoreText); function initializeLevel() { cannon = game.addChild(new Cannon()); cannon.x = 1024; cannon.y = 2600; aimLine = game.addChild(new AimLine()); aimLine.x = cannon.x; aimLine.y = cannon.y; aimLine.visible = false; spawnBallRow(); } function spawnBallRow() { var spacing = 2048 / (ballsPerRow + 1); for (var i = 0; i < ballsPerRow; i++) { if (Math.random() < 0.8) { var ball = new Ball(); ball.x = spacing * (i + 1); ball.y = -50; ball.setNumber(Math.floor(Math.random() * stage * 5) + stage); balls.push(ball); game.addChild(ball); if (Math.random() < 0.15) { var powerup = new PowerUp(); powerup.x = ball.x; powerup.y = ball.y; powerups.push(powerup); game.addChild(powerup); } else if (Math.random() < 0.1) { var star = new Star(); star.x = ball.x; star.y = ball.y; stars.push(star); game.addChild(star); } } } } function fireProjectiles(angle) { for (var i = 0; i < projectileCount; i++) { LK.setTimeout(function () { var projectile = new Projectile(); projectile.x = cannon.x; projectile.y = cannon.y - 40; projectile.velocityX = Math.cos(angle) * projectile.speed; projectile.velocityY = Math.sin(angle) * projectile.speed; projectiles.push(projectile); game.addChild(projectile); LK.getSound('shoot').play(); }, i * 100); } } function checkCollision(obj1, obj2, radius1, radius2) { var dx = obj1.x - obj2.x; var dy = obj1.y - obj2.y; var distance = Math.sqrt(dx * dx + dy * dy); return distance < radius1 + radius2; } function moveRow() { for (var i = 0; i < balls.length; i++) { balls[i].y += 100; } for (var i = 0; i < powerups.length; i++) { powerups[i].y += 100; } for (var i = 0; i < stars.length; i++) { stars[i].y += 100; } spawnBallRow(); } game.down = function (x, y, obj) { if (!canShoot || !gameActive) return; isAiming = true; aimLine.visible = true; }; game.move = function (x, y, obj) { if (!isAiming || !gameActive) return; var dx = x - cannon.x; var dy = y - cannon.y; var angle = Math.atan2(dy, dx); if (angle > -Math.PI && angle < 0) { cannon.rotation = angle + Math.PI / 2; aimLine.rotation = angle + Math.PI / 2; } }; game.up = function (x, y, obj) { if (!isAiming || !gameActive) return; isAiming = false; aimLine.visible = false; canShoot = false; var dx = x - cannon.x; var dy = y - cannon.y; var angle = Math.atan2(dy, dx); if (angle > -Math.PI && angle < 0) { fireProjectiles(angle); } }; game.update = function () { if (!gameActive) return; // Update projectiles for (var i = projectiles.length - 1; i >= 0; i--) { var projectile = projectiles[i]; if (projectile.y > 2732 + 50) { projectile.destroy(); projectiles.splice(i, 1); continue; } // Check ball collisions for (var j = balls.length - 1; j >= 0; j--) { var ball = balls[j]; if (checkCollision(projectile, ball, projectile.radius, ball.radius)) { LK.getSound('hit').play(); if (ball.takeDamage()) { LK.getSound('destroy').play(); LK.setScore(LK.getScore() + stage); scoreText.setText('Score: ' + LK.getScore()); ball.destroy(); balls.splice(j, 1); } var dx = projectile.x - ball.x; var dy = projectile.y - ball.y; var dist = Math.sqrt(dx * dx + dy * dy); dx /= dist; dy /= dist; projectile.velocityX = dx * projectile.speed; projectile.velocityY = dy * projectile.speed; break; } } // Check powerup collisions for (var j = powerups.length - 1; j >= 0; j--) { var powerup = powerups[j]; if (checkCollision(projectile, powerup, projectile.radius, powerup.radius)) { LK.getSound('collect').play(); projectileCount++; projectileCountText.setText('x' + projectileCount); powerup.destroy(); powerups.splice(j, 1); } } // Check star collisions for (var j = stars.length - 1; j >= 0; j--) { var star = stars[j]; if (checkCollision(projectile, star, projectile.radius, star.radius)) { LK.getSound('collect').play(); LK.setScore(LK.getScore() + 10); scoreText.setText('Score: ' + LK.getScore()); star.destroy(); stars.splice(j, 1); } } } // Check if all projectiles are gone if (projectiles.length === 0 && !canShoot) { canShoot = true; moveRow(); if (balls.length === 0) { stage++; stageText.setText('Stage ' + stage); ballSpeed += 0.1; } } // Check game over for (var i = 0; i < balls.length; i++) { if (balls[i].y > 2400) { gameActive = false; LK.showGameOver(); break; } } }; initializeLevel();
===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,339 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+var storage = LK.import("@upit/storage.v1");
+
+/****
+* Classes
+****/
+var AimLine = Container.expand(function () {
+ var self = Container.call(this);
+ for (var i = 0; i < 10; i++) {
+ var dot = self.attachAsset('aimline', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ y: -i * 30,
+ alpha: 0.5 - i * 0.05
+ });
+ }
+ return self;
+});
+var Ball = Container.expand(function () {
+ var self = Container.call(this);
+ var ballGraphics = self.attachAsset('ball', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.numberText = new Text2('1', {
+ size: 40,
+ fill: 0xFFFFFF
+ });
+ self.numberText.anchor.set(0.5, 0.5);
+ self.addChild(self.numberText);
+ self.hits = 1;
+ self.radius = 40;
+ self.velocityX = 0;
+ self.velocityY = 0;
+ self.setNumber = function (num) {
+ self.hits = num;
+ self.numberText.setText(num.toString());
+ var scale = 1 + num / 50 * 0.5;
+ ballGraphics.scale.set(scale);
+ self.radius = 40 * scale;
+ };
+ self.takeDamage = function () {
+ self.hits--;
+ if (self.hits <= 0) {
+ return true;
+ }
+ self.numberText.setText(self.hits.toString());
+ tween(ballGraphics, {
+ scaleX: 0.8,
+ scaleY: 0.8
+ }, {
+ duration: 100,
+ onFinish: function onFinish() {
+ tween(ballGraphics, {
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 100
+ });
+ }
+ });
+ return false;
+ };
+ return self;
+});
+var Cannon = Container.expand(function () {
+ var self = Container.call(this);
+ var cannonGraphics = self.attachAsset('cannon', {
+ anchorX: 0.5,
+ anchorY: 0.8
+ });
+ self.rotation = 0;
+ return self;
+});
+var PowerUp = Container.expand(function () {
+ var self = Container.call(this);
+ var powerupGraphics = self.attachAsset('powerup', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.radius = 20;
+ return self;
+});
+var Projectile = Container.expand(function () {
+ var self = Container.call(this);
+ var projectileGraphics = self.attachAsset('projectile', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.velocityX = 0;
+ self.velocityY = 0;
+ self.speed = 15;
+ self.radius = 10;
+ self.update = function () {
+ self.x += self.velocityX;
+ self.y += self.velocityY;
+ if (self.x <= self.radius || self.x >= 2048 - self.radius) {
+ self.velocityX *= -1;
+ self.x = Math.max(self.radius, Math.min(2048 - self.radius, self.x));
+ }
+ if (self.y <= self.radius) {
+ self.velocityY *= -1;
+ self.y = self.radius;
+ }
+ };
+ return self;
+});
+var Star = Container.expand(function () {
+ var self = Container.call(this);
+ var starGraphics = self.attachAsset('star', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.radius = 25;
+ starGraphics.rotation = Math.PI / 4;
+ self.update = function () {
+ starGraphics.rotation += 0.02;
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x2c3e50
+});
+
+/****
+* Game Code
+****/
+var cannon;
+var aimLine;
+var balls = [];
+var projectiles = [];
+var powerups = [];
+var stars = [];
+var isAiming = false;
+var canShoot = true;
+var projectileCount = 1;
+var stage = 1;
+var ballsPerRow = 6;
+var ballSpeed = 0.5;
+var gameActive = true;
+var stageText = new Text2('Stage 1', {
+ size: 60,
+ fill: 0xFFFFFF
+});
+stageText.anchor.set(0.5, 0);
+stageText.y = 20;
+LK.gui.top.addChild(stageText);
+var projectileCountText = new Text2('x1', {
+ size: 50,
+ fill: 0x4ECDC4
+});
+projectileCountText.anchor.set(0.5, 0);
+projectileCountText.y = 100;
+LK.gui.top.addChild(projectileCountText);
+var scoreText = new Text2('Score: 0', {
+ size: 40,
+ fill: 0xFFFFFF
+});
+scoreText.anchor.set(1, 0);
+scoreText.x = -20;
+scoreText.y = 20;
+LK.gui.topRight.addChild(scoreText);
+function initializeLevel() {
+ cannon = game.addChild(new Cannon());
+ cannon.x = 1024;
+ cannon.y = 2600;
+ aimLine = game.addChild(new AimLine());
+ aimLine.x = cannon.x;
+ aimLine.y = cannon.y;
+ aimLine.visible = false;
+ spawnBallRow();
+}
+function spawnBallRow() {
+ var spacing = 2048 / (ballsPerRow + 1);
+ for (var i = 0; i < ballsPerRow; i++) {
+ if (Math.random() < 0.8) {
+ var ball = new Ball();
+ ball.x = spacing * (i + 1);
+ ball.y = -50;
+ ball.setNumber(Math.floor(Math.random() * stage * 5) + stage);
+ balls.push(ball);
+ game.addChild(ball);
+ if (Math.random() < 0.15) {
+ var powerup = new PowerUp();
+ powerup.x = ball.x;
+ powerup.y = ball.y;
+ powerups.push(powerup);
+ game.addChild(powerup);
+ } else if (Math.random() < 0.1) {
+ var star = new Star();
+ star.x = ball.x;
+ star.y = ball.y;
+ stars.push(star);
+ game.addChild(star);
+ }
+ }
+ }
+}
+function fireProjectiles(angle) {
+ for (var i = 0; i < projectileCount; i++) {
+ LK.setTimeout(function () {
+ var projectile = new Projectile();
+ projectile.x = cannon.x;
+ projectile.y = cannon.y - 40;
+ projectile.velocityX = Math.cos(angle) * projectile.speed;
+ projectile.velocityY = Math.sin(angle) * projectile.speed;
+ projectiles.push(projectile);
+ game.addChild(projectile);
+ LK.getSound('shoot').play();
+ }, i * 100);
+ }
+}
+function checkCollision(obj1, obj2, radius1, radius2) {
+ var dx = obj1.x - obj2.x;
+ var dy = obj1.y - obj2.y;
+ var distance = Math.sqrt(dx * dx + dy * dy);
+ return distance < radius1 + radius2;
+}
+function moveRow() {
+ for (var i = 0; i < balls.length; i++) {
+ balls[i].y += 100;
+ }
+ for (var i = 0; i < powerups.length; i++) {
+ powerups[i].y += 100;
+ }
+ for (var i = 0; i < stars.length; i++) {
+ stars[i].y += 100;
+ }
+ spawnBallRow();
+}
+game.down = function (x, y, obj) {
+ if (!canShoot || !gameActive) return;
+ isAiming = true;
+ aimLine.visible = true;
+};
+game.move = function (x, y, obj) {
+ if (!isAiming || !gameActive) return;
+ var dx = x - cannon.x;
+ var dy = y - cannon.y;
+ var angle = Math.atan2(dy, dx);
+ if (angle > -Math.PI && angle < 0) {
+ cannon.rotation = angle + Math.PI / 2;
+ aimLine.rotation = angle + Math.PI / 2;
+ }
+};
+game.up = function (x, y, obj) {
+ if (!isAiming || !gameActive) return;
+ isAiming = false;
+ aimLine.visible = false;
+ canShoot = false;
+ var dx = x - cannon.x;
+ var dy = y - cannon.y;
+ var angle = Math.atan2(dy, dx);
+ if (angle > -Math.PI && angle < 0) {
+ fireProjectiles(angle);
+ }
+};
+game.update = function () {
+ if (!gameActive) return;
+ // Update projectiles
+ for (var i = projectiles.length - 1; i >= 0; i--) {
+ var projectile = projectiles[i];
+ if (projectile.y > 2732 + 50) {
+ projectile.destroy();
+ projectiles.splice(i, 1);
+ continue;
+ }
+ // Check ball collisions
+ for (var j = balls.length - 1; j >= 0; j--) {
+ var ball = balls[j];
+ if (checkCollision(projectile, ball, projectile.radius, ball.radius)) {
+ LK.getSound('hit').play();
+ if (ball.takeDamage()) {
+ LK.getSound('destroy').play();
+ LK.setScore(LK.getScore() + stage);
+ scoreText.setText('Score: ' + LK.getScore());
+ ball.destroy();
+ balls.splice(j, 1);
+ }
+ var dx = projectile.x - ball.x;
+ var dy = projectile.y - ball.y;
+ var dist = Math.sqrt(dx * dx + dy * dy);
+ dx /= dist;
+ dy /= dist;
+ projectile.velocityX = dx * projectile.speed;
+ projectile.velocityY = dy * projectile.speed;
+ break;
+ }
+ }
+ // Check powerup collisions
+ for (var j = powerups.length - 1; j >= 0; j--) {
+ var powerup = powerups[j];
+ if (checkCollision(projectile, powerup, projectile.radius, powerup.radius)) {
+ LK.getSound('collect').play();
+ projectileCount++;
+ projectileCountText.setText('x' + projectileCount);
+ powerup.destroy();
+ powerups.splice(j, 1);
+ }
+ }
+ // Check star collisions
+ for (var j = stars.length - 1; j >= 0; j--) {
+ var star = stars[j];
+ if (checkCollision(projectile, star, projectile.radius, star.radius)) {
+ LK.getSound('collect').play();
+ LK.setScore(LK.getScore() + 10);
+ scoreText.setText('Score: ' + LK.getScore());
+ star.destroy();
+ stars.splice(j, 1);
+ }
+ }
+ }
+ // Check if all projectiles are gone
+ if (projectiles.length === 0 && !canShoot) {
+ canShoot = true;
+ moveRow();
+ if (balls.length === 0) {
+ stage++;
+ stageText.setText('Stage ' + stage);
+ ballSpeed += 0.1;
+ }
+ }
+ // Check game over
+ for (var i = 0; i < balls.length; i++) {
+ if (balls[i].y > 2400) {
+ gameActive = false;
+ LK.showGameOver();
+ break;
+ }
+ }
+};
+initializeLevel();
\ No newline at end of file
Renkli yuvarlak Balon, üstten görünüm, Gerçekçi, yazısız.. In-Game asset. High contrast. No shadows
tek renk top, üstten görünüm, Gerçekçi, yazısız.. In-Game asset. 2d. High contrast. No shadows
tek renk top, üstten görünüm, Gerçekçi, yazısız.. In-Game asset. High contrast. No shadows
tek renk top, üstten görünüm, Gerçekçi, yazısız.. In-Game asset. High contrast. No shadows
tek renk top, üstten görünüm, Gerçekçi, yazısız.. In-Game asset. High contrast. No shadows
tek renk top, üstten görünüm, Gerçekçi, yazısız.. In-Game asset. High contrast. No shadows
tek renk top, üstten görünüm, Gerçekçi, yazısız.. In-Game asset. High contrast. No shadows