User prompt
Butonlar oyunu durdurma simgesinin altında olsun
User prompt
areBorder gözükmüyor
Code edit (1 edits merged)
Please save this source code
User prompt
oyunun sınırları görünsün
User prompt
oyunun sınırları belli olsun
User prompt
oyunun arka plan resmi olsun
User prompt
duvarlara 3 kere çarpınca duvar kırılsın. Duvara çarpma anında duvar üzerinde çatlak oluşsun, tekrar çarptığında çatlar büyüsün. 3. kez çarptığında kırılma sesi ile birlikte duvar yok olsun.
Code edit (1 edits merged)
Please save this source code
User prompt
butonları sağ üste koy
User prompt
aynı leveli tekar oynamak için buton ekle, oyunu baştan başlatan butonu kaldırma
User prompt
oyunu tekrar level 1 den başlatmak için buton ekle
User prompt
silahım yönü eğim çizgisi ile aynı yöne bakmalı
User prompt
Merminin yönü gittiği yöne doğru olmalı
User prompt
use aimline image for aimline
User prompt
Eğim çizgisi aynı resmin tekrar etmesinden oluşsun
User prompt
duvarlar hedefin ve benim ile aynı X ekseninde çıkmasın
User prompt
Duvarların sayısı en fazla 10 olsun
User prompt
aynı leveli tekrar oynadığımda duvarların yeri de değişmesin
User prompt
Aynı leveli tekrar oynadığımda yerleri değişmesin
User prompt
Aynı levele baştan başlayabilmek için bir buton olmalı
User prompt
Her levelde benim ve hedefin yeri değişsin ama sadece X eksenleri
User prompt
Level sayacı olsun
User prompt
engeller sadece ortada değil farklı yerlerde de çıkabilmeli
User prompt
continue
User prompt
Ricochet Shot: Target Master
/**** * Classes ****/ // Bullet class var Bullet = Container.expand(function () { var self = Container.call(this); var bulletAsset = self.attachAsset('bullet', { anchorX: 0.5, anchorY: 0.5 }); self.radius = bulletAsset.width / 2; self.vx = 0; self.vy = 0; self.lastX = 0; self.lastY = 0; self.update = function () { self.lastX = self.x; self.lastY = self.y; self.x += self.vx; self.y += self.vy; // Wall bounce if (self.x - self.radius <= ARENA_X && self.lastX - self.radius > ARENA_X) { self.x = ARENA_X + self.radius; self.vx *= -1; } if (self.x + self.radius >= ARENA_X + ARENA_SIZE && self.lastX + self.radius < ARENA_X + ARENA_SIZE) { self.x = ARENA_X + ARENA_SIZE - self.radius; self.vx *= -1; } if (self.y - self.radius <= ARENA_Y && self.lastY - self.radius > ARENA_Y) { self.y = ARENA_Y + self.radius; self.vy *= -1; } if (self.y + self.radius >= ARENA_Y + ARENA_SIZE && self.lastY + self.radius < ARENA_Y + ARENA_SIZE) { self.y = ARENA_Y + ARENA_SIZE - self.radius; self.vy *= -1; } }; return self; }); // Obstacle class var Obstacle = Container.expand(function () { var self = Container.call(this); var obsAsset = self.attachAsset('obstacle', { anchorX: 0.5, anchorY: 0.5 }); self.width = obsAsset.width; self.height = obsAsset.height; return self; }); // Player class var Player = Container.expand(function () { var self = Container.call(this); var playerAsset = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); self.radius = playerAsset.width / 2; return self; }); // Target class var Target = Container.expand(function () { var self = Container.call(this); var targetAsset = self.attachAsset('target', { anchorX: 0.5, anchorY: 0.5 }); self.radius = targetAsset.width / 2; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ // Arena and gameplay variables var ARENA_SIZE = 1800; // Square arena, fits well in 2048x2732 var ARENA_X = (2048 - ARENA_SIZE) / 2; var ARENA_Y = (2732 - ARENA_SIZE) / 2; var player = null; var target = null; var bullets = []; var obstacles = []; var level = 1; var isAiming = false; var aimLine = null; var aimStart = null; var aimEnd = null; function setupLevel(lvl) { // Clear previous if (player) player.destroy(); if (target) target.destroy(); for (var i = 0; i < bullets.length; ++i) bullets[i].destroy(); bullets = []; for (var i = 0; i < obstacles.length; ++i) obstacles[i].destroy(); obstacles = []; // Player at bottom center player = new Player(); player.x = ARENA_X + ARENA_SIZE / 2; player.y = ARENA_Y + ARENA_SIZE - 120; game.addChild(player); // Target at top center target = new Target(); target.x = ARENA_X + ARENA_SIZE / 2; target.y = ARENA_Y + 120; game.addChild(target); // Obstacles for level > 1 if (lvl > 1) { var obsCount = Math.min(lvl - 1, 5); for (var i = 0; i < obsCount; ++i) { var obs = new Obstacle(); // Distribute obstacles at different positions, not just center // Alternate between left, right, and center, and randomize Y var posType = i % 3; var margin = 200; var xPos; if (posType === 0) { // Left third xPos = ARENA_X + margin + obs.width / 2; } else if (posType === 1) { // Right third xPos = ARENA_X + ARENA_SIZE - margin - obs.width / 2; } else { // Center xPos = ARENA_X + ARENA_SIZE / 2; } // Y position: spread vertically, but randomize a bit var yBase = ARENA_Y + ARENA_SIZE / (obsCount + 1) * (i + 1); var yRand = Math.random() * 120 - 60; // -60 to +60 px obs.x = xPos; obs.y = yBase + yRand; game.addChild(obs); obstacles.push(obs); } } } setupLevel(level); // Aiming and shooting game.down = function (x, y, obj) { // Only allow aiming if no bullet is in play if (bullets.length === 0) { isAiming = true; aimStart = { x: player.x, y: player.y }; aimEnd = { x: x, y: y }; } }; game.move = function (x, y, obj) { if (isAiming) { aimEnd = { x: x, y: y }; } }; game.up = function (x, y, obj) { if (isAiming) { // Fire bullet var dx = aimEnd.x - player.x; var dy = aimEnd.y - player.y; var len = Math.sqrt(dx * dx + dy * dy); if (len > 10) { var bullet = new Bullet(); bullet.x = player.x; bullet.y = player.y; var speed = 30; bullet.vx = dx / len * speed; bullet.vy = dy / len * speed; bullets.push(bullet); game.addChild(bullet); } isAiming = false; aimStart = null; aimEnd = null; } }; // Main update loop game.update = function () { // Draw aim line if aiming if (isAiming && aimStart && aimEnd) { if (!aimLine) { aimLine = LK.getAsset('aimLine', { anchorX: 0, anchorY: 0 }); game.addChild(aimLine); } // Set aimLine position and size var dx = aimEnd.x - aimStart.x; var dy = aimEnd.y - aimStart.y; var len = Math.sqrt(dx * dx + dy * dy); aimLine.x = aimStart.x; aimLine.y = aimStart.y; aimLine.width = len; aimLine.height = 10; aimLine.rotation = Math.atan2(dy, dx); } else if (aimLine) { aimLine.destroy(); aimLine = null; } // Update bullets for (var i = bullets.length - 1; i >= 0; --i) { var b = bullets[i]; b.update(); // Check collision with target var dx = b.x - target.x; var dy = b.y - target.y; var dist = Math.sqrt(dx * dx + dy * dy); if (dist < b.radius + target.radius) { // Hit! Next level b.destroy(); bullets.splice(i, 1); level += 1; setupLevel(level); return; } // Check collision with obstacles for (var j = 0; j < obstacles.length; ++j) { var obs = obstacles[j]; var left = obs.x - obs.width / 2; var right = obs.x + obs.width / 2; var top = obs.y - obs.height / 2; var bottom = obs.y + obs.height / 2; // Simple AABB collision if (b.x + b.radius > left && b.x - b.radius < right && b.y + b.radius > top && b.y - b.radius < bottom) { // Reflect bullet: pick axis of minimum penetration var overlapX = Math.min(Math.abs(b.x + b.radius - left), Math.abs(b.x - b.radius - right)); var overlapY = Math.min(Math.abs(b.y + b.radius - top), Math.abs(b.y - b.radius - bottom)); if (overlapX < overlapY) { b.vx *= -1; } else { b.vy *= -1; } } } // Remove bullet if out of arena for too long (failsafe) if (b.x < ARENA_X - 200 || b.x > ARENA_X + ARENA_SIZE + 200 || b.y < ARENA_Y - 200 || b.y > ARENA_Y + ARENA_SIZE + 200) { b.destroy(); bullets.splice(i, 1); } } };
===================================================================
--- original.js
+++ change.js
@@ -115,10 +115,28 @@
if (lvl > 1) {
var obsCount = Math.min(lvl - 1, 5);
for (var i = 0; i < obsCount; ++i) {
var obs = new Obstacle();
- obs.x = ARENA_X + ARENA_SIZE / 2;
- obs.y = ARENA_Y + ARENA_SIZE / (obsCount + 1) * (i + 1);
+ // Distribute obstacles at different positions, not just center
+ // Alternate between left, right, and center, and randomize Y
+ var posType = i % 3;
+ var margin = 200;
+ var xPos;
+ if (posType === 0) {
+ // Left third
+ xPos = ARENA_X + margin + obs.width / 2;
+ } else if (posType === 1) {
+ // Right third
+ xPos = ARENA_X + ARENA_SIZE - margin - obs.width / 2;
+ } else {
+ // Center
+ xPos = ARENA_X + ARENA_SIZE / 2;
+ }
+ // Y position: spread vertically, but randomize a bit
+ var yBase = ARENA_Y + ARENA_SIZE / (obsCount + 1) * (i + 1);
+ var yRand = Math.random() * 120 - 60; // -60 to +60 px
+ obs.x = xPos;
+ obs.y = yBase + yRand;
game.addChild(obs);
obstacles.push(obs);
}
}
full blue screen. In-Game asset. 2d. High contrast. No shadows
gülle. In-Game asset. 2d. High contrast. No shadows
castle wall. In-Game asset. 2d. High contrast. No shadows
only the mouth part of the cannon and looking at the vertical. In-Game asset. 2d. High contrast. No shadows
castle. In-Game asset. 2d. High contrast. No shadows
kırık
daha çok kırık
yıkılmış kale
next button , no background. In-Game asset. 2d. High contrast. No shadows