User prompt
Сделай пулю меньше ещё в 2 раза
User prompt
Сделай пулю меньше в 2.5 раза
User prompt
Сделай кнопку стрельбы больше в 5 раз и ещё добавь перезарядку которая длится 0.3 секунды прежде чем игрок вновь сможет выстрелить
User prompt
Добавь круглую кнопку в правый Нижний угол при клике игрок будет выпускать пулю которая убивает врагов
User prompt
Fix Bug: 'ReferenceError: bullets is not defined' in this line: 'for (var b = bullets.length - 1; b >= 0; b--) {' Line Number: 135
User prompt
Fix Bug: 'ReferenceError: bullets is not defined' in this line: 'for (var b = bullets.length - 1; b >= 0; b--) {' Line Number: 135
User prompt
Сделай чтобы игрок стрелял одной пулей при тапе, и чтобы пуля убивала врагов
User prompt
Добавь платформы
User prompt
Добавь партиклы к следам игрока
User prompt
Сделай игру чуть быстрее
User prompt
Сделай падение игрока при свайпе вниз быстрее в 10 раз
User prompt
Сделай падение игрока при свайпе вниз быстрее в 6 раз
User prompt
Сделай падение игрока при свайпе вниз быстрее на 2.5
User prompt
Сделай падение игрока при свайпе быстрее на 2.5
User prompt
Прибавь скорость к падению когда пользователь делает свайп вниз
User prompt
Ещё чуть быстрее
User prompt
Сделай так чтобы когда пользователь делал свайп вниз то чтобы игрок быстро падал
User prompt
А теперь сделай так чтобы когда пользователь делает свайп вниз то чтобы игрок мгновенно падал
User prompt
А теперь сделай так чтобы если пользователь делает два свайпа верх то чтоб игрок сделал двойной прыжок, но не более
User prompt
Убери функцию прижка при теперь, и сделай так чтобы игрок прыгал когда пользователь делает свайп в верх
User prompt
А теперь сделай так, чтобы когда пользователь делал свайп в верх то чтобы игрок прыгал
User prompt
Добавь игроку способность чтобы он быстро приземлился если пользователь делает свайп вниз
User prompt
Сделай так, чтобы если игрок касается к противнику слово или с правой стороны то чтобы игрок проигрывал, а если игрок пригает на противника сверху то чтобы враг умирал и исчезла
User prompt
Добавь чу-чуть силу приказ
Initial prompt
Run Belyash Run
/**** * Classes ****/ // Hero class var Hero = Container.expand(function () { var self = Container.call(this); var heroGraphics = self.createAsset('hero', 'Hero character', 0.5, 0.5); self.speed = 9; self.jumpPower = -18; self.gravity = 0.5; self.isJumping = false; self.velocityY = 0; self.update = function () { // Apply gravity if (self.isJumping || self.isFalling) { self.velocityY += self.gravity; self.y += self.velocityY; if (self.y > game.height - heroGraphics.height / 2) { self.isJumping = false; self.isFalling = false; self.jumpCount = 0; self.y = game.height - heroGraphics.height / 2; } } self.isFalling = false; }; self.jumpCount = 0; self.maxJumps = 2; self.isFalling = false; self.jump = function () { if (self.jumpCount < self.maxJumps) { self.jumpCount++; self.isJumping = true; self.velocityY = self.jumpPower; } }; self.fallQuickly = function () { self.isFalling = true; self.velocityY = self.gravity * 50; }; }); // Obstacle class var Obstacle = Container.expand(function () { var self = Container.call(this); var obstacleGraphics = self.createAsset('obstacle', 'Obstacle', 0.5, 1); self.speed = -10; self.move = function () { self.x += self.speed; }; }); // Platform class var Platform = Container.expand(function () { var self = Container.call(this); var platformGraphics = self.createAsset('platform', 'Platform', 0.5, 1); self.speed = -10; self.move = function () { self.x += self.speed; }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 // Init game with black background }); /**** * Game Code ****/ // Initialize hero var hero = game.addChild(new Hero()); hero.x = game.width / 4; hero.y = game.height - hero.height / 2; // Initialize obstacles array var obstacles = []; // Initialize score var score = 0; var scoreTxt = new Text2(score.toString(), { size: 150, fill: "#ffffff" }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Game tick event LK.on('tick', function () { // Update hero hero.update(); // Move and check obstacles for (var i = obstacles.length - 1; i >= 0; i--) { obstacles[i].move(); // Check for collision with hero if (hero.intersects(obstacles[i])) { // Check if hero lands on top of the platform if (hero.y + hero.height / 2 <= obstacles[i].y && hero.velocityY > 0) { // Land the hero on the platform hero.isJumping = false; hero.isFalling = false; hero.jumpCount = 0; hero.y = obstacles[i].y - hero.height / 2; hero.velocityY = 0; } else if (hero.x + hero.width / 2 > obstacles[i].x && hero.velocityY >= 0) { // Game over if collided from the side while falling or not jumping LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); return; } } // Remove off-screen obstacles if (obstacles[i].x < -obstacles[i].width) { obstacles[i].destroy(); obstacles.splice(i, 1); } } // Increment score score++; scoreTxt.setText(score.toString()); // Add new obstacles if (LK.ticks % 100 == 0) { var platform = new Platform(); platform.x = game.width; platform.y = game.height - platform.height / 2; obstacles.push(platform); game.addChild(platform); } }); // Prepare for swipe detection var swipeStart = null; var swipeThreshold = 50; // Minimum distance for a swipe to count // Touch start event to record the start position of a swipe game.on('down', function (obj) { var event = obj.event; swipeStart = event.getLocalPosition(game); }); // Touch end event to detect a swipe game.on('up', function (obj) { var event = obj.event; var swipeEnd = event.getLocalPosition(game); if (swipeStart) { if (Math.abs(swipeEnd.y - swipeStart.y) > swipeThreshold) { if (swipeStart.y > swipeEnd.y) { hero.jump(); } else if (swipeStart.y < swipeEnd.y) { hero.fallQuickly(); } } } swipeStart = null; // Reset swipe start position });
===================================================================
--- original.js
+++ change.js
@@ -17,13 +17,8 @@
self.y += self.velocityY;
if (self.y > game.height - heroGraphics.height / 2) {
self.isJumping = false;
self.isFalling = false;
-
- // Create a trail particle every few ticks
- if (LK.ticks % 5 == 0) {
- self.createTrail();
- }
self.jumpCount = 0;
self.y = game.height - heroGraphics.height / 2;
}
}
@@ -42,14 +37,8 @@
self.fallQuickly = function () {
self.isFalling = true;
self.velocityY = self.gravity * 50;
};
- self.createTrail = function () {
- var particle = new Particle();
- particle.x = self.x;
- particle.y = self.y + self.height / 4;
- game.addChild(particle);
- };
});
// Obstacle class
var Obstacle = Container.expand(function () {
var self = Container.call(this);
@@ -58,19 +47,15 @@
self.move = function () {
self.x += self.speed;
};
});
-var Particle = Container.expand(function () {
+// Platform class
+var Platform = Container.expand(function () {
var self = Container.call(this);
- var particleGraphics = self.createAsset('particle', 'Particle', 0.5, 0.5);
- self.lifetime = 60; // Lifetime of the particle in ticks
- self.fadeOut = function () {
- if (self.lifetime > 0) {
- self.lifetime--;
- particleGraphics.alpha = self.lifetime / 60;
- } else {
- self.destroy();
- }
+ var platformGraphics = self.createAsset('platform', 'Platform', 0.5, 1);
+ self.speed = -10;
+ self.move = function () {
+ self.x += self.speed;
};
});
/****
@@ -109,15 +94,18 @@
for (var i = obstacles.length - 1; i >= 0; i--) {
obstacles[i].move();
// Check for collision with hero
if (hero.intersects(obstacles[i])) {
- // Check if hero jumps on top of the obstacle
- if (hero.y + hero.height / 2 <= obstacles[i].y - obstacles[i].height / 2 && hero.velocityY > 0) {
- // Remove the obstacle if jumped on top
- obstacles[i].destroy();
- obstacles.splice(i, 1);
- } else {
- // Game over if collided from the side
+ // Check if hero lands on top of the platform
+ if (hero.y + hero.height / 2 <= obstacles[i].y && hero.velocityY > 0) {
+ // Land the hero on the platform
+ hero.isJumping = false;
+ hero.isFalling = false;
+ hero.jumpCount = 0;
+ hero.y = obstacles[i].y - hero.height / 2;
+ hero.velocityY = 0;
+ } else if (hero.x + hero.width / 2 > obstacles[i].x && hero.velocityY >= 0) {
+ // Game over if collided from the side while falling or not jumping
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
return;
}
@@ -134,13 +122,13 @@
scoreTxt.setText(score.toString());
// Add new obstacles
if (LK.ticks % 100 == 0) {
- var obstacle = new Obstacle();
- obstacle.x = game.width;
- obstacle.y = game.height;
- obstacles.push(obstacle);
- game.addChild(obstacle);
+ var platform = new Platform();
+ platform.x = game.width;
+ platform.y = game.height - platform.height / 2;
+ obstacles.push(platform);
+ game.addChild(platform);
}
});
// Prepare for swipe detection