User prompt
O zaman her 5 puanda bir rouglike seçme ekranı olsun şimdilik bunlar olsun devamını ekleyeceğim
User prompt
Hayır mesela orada tıklamamız gerekecek yani play butonuna arkası simsiyah olabilir
User prompt
Hayır tıklayıp oyuna başlayabileceğimiz bir ana menü
User prompt
Oyuna bir başlangıç ekranı koylalım hani başla tuşudur falan
User prompt
Yılan sağ sola hareket ettirilmiyor
User prompt
Neyse ekrana tıklama olsun baya buglu çalışıyor
User prompt
Bence şöyle olsun kırmızı buton oyunda her zaman ekranın sol köşesinin altında olsun ve tıkladığında yılanın baktığı yöne ateş etsin yani yılan donmasın
User prompt
Kutulu odalarda oyun crash veriyo
User prompt
O zaman şöyle yapalım bi kırmızı tuş ekle ve bu tuşa basıldığında ateş edilsin
User prompt
Şimdi de kutulu elma gelince oyun durdu
User prompt
Kutulu odalar gelince hareket edilmiyor
User prompt
Ama şu an ekrana tıklıyorum ve ateş etmiyor
User prompt
Oyunda iki tuş ekleyelim biri bizim silah ateşleme tuşu olurken digeri kılıç tuşu olsun kılıç da şu işe yarıyor oyunda düşmanlar olacak ve silahla ölmeyecek bizde onları kılıçla devirecez ama hareket için tuşlar ekleme
User prompt
Oyuna bir başlangıç ekranı ekleyelim yazan isimi yerde "snaker" yazsın
User prompt
Elmalar ya da kutular gidebileceğimiz pixel pixel yerlere göre değişsin yani tam da gidebileceğimiz pixellerin üstünde olsun
User prompt
Mermi assetlerinin yönü baktığımız yere göre değişsin
User prompt
Bence daha açık renkli olsun ya da sen arkaya image koy ben yaprım
User prompt
Sen şu oyun alanını birazcık renkli yap canlı olsun
User prompt
Ama kutulu elmalar geldiğinde başka bi elma olmasın yani illaki onu kırıp elmayı yememiz gereksin
User prompt
Yılanın gittiği yöne ateş etsin
User prompt
Artık oyunda bazen %25 ihtimalle kutulu elmalar olacak bu elmalara çarpışınca ölecek yiyebilmek için elimizdeki silahla ona ateş edip sonra yememiz gerekecek
User prompt
Generate the first version of the source code of my game: Snake Classic.
User prompt
Snake Classic
Initial prompt
Bir oyun bu oyun snake e benzer bir oyun olacak ama daha kalitlerisi şimdilik normal snake oyunu yap
/**** * Classes ****/ // BoxFood class (dangerous apple) var BoxFood = Container.expand(function () { var self = Container.call(this); var boxAsset = self.attachAsset('boxFood', { anchorX: 0.5, anchorY: 0.5 }); self.isBox = true; self.destroyedByBullet = false; return self; }); // Bullet class var Bullet = Container.expand(function () { var self = Container.call(this); var bulletAsset = self.attachAsset('bullet', { anchorX: 0.5, anchorY: 0.5 }); // Default speed values (will be set on fire) self.speedX = 32; self.speedY = 0; self.update = function () { self.lastX = self.x; self.lastY = self.y; self.x += self.speedX; self.y += self.speedY; }; return self; }); // Food class var Food = Container.expand(function () { var self = Container.call(this); var foodAsset = self.attachAsset('food', { anchorX: 0.5, anchorY: 0.5 }); self.isBox = false; return self; }); // Snake segment class var Segment = Container.expand(function () { var self = Container.call(this); var segAsset = self.attachAsset('snakeSegment', { anchorX: 0.5, anchorY: 0.5 }); return self; }); // Snake class var Snake = Container.expand(function () { var self = Container.call(this); self.segments = []; self.direction = 'right'; self.nextDirection = 'right'; self.moveTimer = 0; self.moveInterval = 16; // Lower is faster, 16 = ~4 moves/sec at 60fps self.alive = true; // Initialize snake with 4 segments for (var i = 0; i < 4; i++) { var seg = new Segment(); seg.x = 1024 - i * 64; seg.y = 1366; self.addChild(seg); self.segments.push(seg); } self.update = function () { if (!self.alive) return; self.moveTimer++; if (self.moveTimer < self.moveInterval) return; self.moveTimer = 0; // Update direction self.direction = self.nextDirection; // Calculate new head position var head = self.segments[0]; var newX = head.x; var newY = head.y; if (self.direction === 'right') newX += 64;else if (self.direction === 'left') newX -= 64;else if (self.direction === 'up') newY -= 64;else if (self.direction === 'down') newY += 64; // Move body for (var i = self.segments.length - 1; i > 0; i--) { self.segments[i].x = self.segments[i - 1].x; self.segments[i].y = self.segments[i - 1].y; } head.x = newX; head.y = newY; }; self.grow = function () { var last = self.segments[self.segments.length - 1]; var seg = new Segment(); seg.x = last.x; seg.y = last.y; self.addChild(seg); self.segments.push(seg); }; return self; }); /**** * Initialize Game ****/ // Game variables var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ // Game variables var snake; var food; var scoreTxt; var gameOver = false; var bullets = []; var boxFoods = []; var boxFoodActive = false; var boxFoodObj = null; // Create snake snake = new Snake(); game.addChild(snake); // Create food function spawnFood() { // Remove previous food if (food) food.destroy(); // Remove previous box food if present if (boxFoodObj) { boxFoodObj.destroy(); boxFoodObj = null; boxFoodActive = false; } // 25% chance to spawn box food if (Math.random() < 0.25) { var valid = false; var newBoxFood = new BoxFood(); while (!valid) { newBoxFood.x = 64 + Math.floor(Math.random() * ((2048 - 128) / 64)) * 64; newBoxFood.y = 64 + Math.floor(Math.random() * ((2732 - 128) / 64)) * 64; valid = true; for (var i = 0; i < snake.segments.length; i++) { if (Math.abs(snake.segments[i].x - newBoxFood.x) < 1 && Math.abs(snake.segments[i].y - newBoxFood.y) < 1) { valid = false; break; } } } game.addChild(newBoxFood); boxFoods.push(newBoxFood); boxFoodObj = newBoxFood; boxFoodActive = true; // Do not spawn normal food when box food is active food = null; } else { // Only normal food food = new Food(); var valid = false; while (!valid) { food.x = 64 + Math.floor(Math.random() * ((2048 - 128) / 64)) * 64; food.y = 64 + Math.floor(Math.random() * ((2732 - 128) / 64)) * 64; valid = true; for (var i = 0; i < snake.segments.length; i++) { if (Math.abs(snake.segments[i].x - food.x) < 1 && Math.abs(snake.segments[i].y - food.y) < 1) { valid = false; break; } } } game.addChild(food); boxFoodActive = false; boxFoodObj = null; } } spawnFood(); // Score text scoreTxt = new Text2('0', { size: 120, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Game update game.update = function () { if (gameOver) return; snake.update(); // Check wall collision var head = snake.segments[0]; if (head.x < 0 || head.x > 2048 || head.y < 0 || head.y > 2732) { gameOver = true; LK.showGameOver(); return; } // Check self collision for (var i = 1; i < snake.segments.length; i++) { if (Math.abs(head.x - snake.segments[i].x) < 1 && Math.abs(head.y - snake.segments[i].y) < 1) { gameOver = true; LK.showGameOver(); return; } } // Handle bullets for (var b = bullets.length - 1; b >= 0; b--) { var bullet = bullets[b]; bullet.update(); // Remove bullet if off screen if (bullet.x > 2048 + 32) { bullet.destroy(); bullets.splice(b, 1); continue; } // Check collision with box food if (boxFoodActive && boxFoodObj && !boxFoodObj.destroyedByBullet && bullet.intersects(boxFoodObj)) { boxFoodObj.destroyedByBullet = true; bullet.destroy(); bullets.splice(b, 1); // Change box food color to indicate it's now edible (optional: destroy and respawn as normal food) boxFoodObj.attachAsset('food', { anchorX: 0.5, anchorY: 0.5 }); } } // Check food collision if (head.intersects(food)) { snake.grow(); LK.setScore(LK.getScore() + 1); scoreTxt.setText(LK.getScore()); spawnFood(); // Speed up as snake grows if (snake.moveInterval > 4) snake.moveInterval--; } // Check box food collision if (boxFoodActive && boxFoodObj) { if (head.intersects(boxFoodObj)) { if (boxFoodObj.destroyedByBullet) { // Now edible snake.grow(); LK.setScore(LK.getScore() + 2); // Maybe more points for box food scoreTxt.setText(LK.getScore()); boxFoodObj.destroy(); boxFoodObj = null; boxFoodActive = false; spawnFood(); if (snake.moveInterval > 4) snake.moveInterval--; } else { // Deadly! gameOver = true; LK.showGameOver(); return; } } } }; // Touch controls var lastTouchX = null; var lastTouchY = null; game.down = function (x, y, obj) { lastTouchX = x; lastTouchY = y; // Fire bullet from snake head in the direction the snake is moving if box food is active if (boxFoodActive && boxFoodObj && snake && snake.segments.length > 0) { var head = snake.segments[0]; var bullet = new Bullet(); bullet.x = head.x; bullet.y = head.y; bullet.lastX = bullet.x; // Set bullet speed and direction based on snake direction if (snake.direction === 'right') { bullet.speedX = 32; bullet.speedY = 0; } else if (snake.direction === 'left') { bullet.speedX = -32; bullet.speedY = 0; } else if (snake.direction === 'up') { bullet.speedX = 0; bullet.speedY = -32; } else if (snake.direction === 'down') { bullet.speedX = 0; bullet.speedY = 32; } bullets.push(bullet); game.addChild(bullet); } }; game.up = function (x, y, obj) { if (lastTouchX === null || lastTouchY === null) return; var dx = x - lastTouchX; var dy = y - lastTouchY; if (Math.abs(dx) > Math.abs(dy)) { if (dx > 0 && snake.direction !== 'left') snake.nextDirection = 'right';else if (dx < 0 && snake.direction !== 'right') snake.nextDirection = 'left'; } else { if (dy > 0 && snake.direction !== 'up') snake.nextDirection = 'down';else if (dy < 0 && snake.direction !== 'down') snake.nextDirection = 'up'; } lastTouchX = null; lastTouchY = null; };
===================================================================
--- original.js
+++ change.js
@@ -148,27 +148,10 @@
game.addChild(newBoxFood);
boxFoods.push(newBoxFood);
boxFoodObj = newBoxFood;
boxFoodActive = true;
- // Also spawn a normal food, but not on the same spot
- valid = false;
- food = new Food();
- while (!valid) {
- food.x = 64 + Math.floor(Math.random() * ((2048 - 128) / 64)) * 64;
- food.y = 64 + Math.floor(Math.random() * ((2732 - 128) / 64)) * 64;
- valid = true;
- // Avoid snake and box food
- for (var i = 0; i < snake.segments.length; i++) {
- if (Math.abs(snake.segments[i].x - food.x) < 1 && Math.abs(snake.segments[i].y - food.y) < 1) {
- valid = false;
- break;
- }
- }
- if (valid && Math.abs(food.x - newBoxFood.x) < 1 && Math.abs(food.y - newBoxFood.y) < 1) {
- valid = false;
- }
- }
- game.addChild(food);
+ // Do not spawn normal food when box food is active
+ food = null;
} else {
// Only normal food
food = new Food();
var valid = false;
Bir top pixel art yeşil renkli. In-Game asset. 2d. High contrast. No shadows
Pixel art bullet. In-Game asset. 2d. High contrast. No shadows
Pixel art apple. In-Game asset. 2d. High contrast. No shadows
Çimen ama bütün elranı kaplıyor . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Kırmızı bir pixel art oyun tuşu. In-Game asset. 2d. High contrast. No shadows
2D pixel art para kasası. In-Game asset. High contrast. No shadows
A red MONSTER . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat