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 = 5; self.jumpPower = -18; self.gravity = 0.5; self.isJumping = false; self.velocityY = 0; self.update = function () { // Apply gravity if (self.isJumping) { self.velocityY += self.gravity; self.y += self.velocityY; if (self.y > game.height - heroGraphics.height / 2) { self.isJumping = false; self.y = game.height - heroGraphics.height / 2; } } }; self.jump = function () { if (!self.isJumping) { self.isJumping = true; self.velocityY = self.jumpPower; } }; }); // Obstacle class var Obstacle = Container.expand(function () { var self = Container.call(this); var obstacleGraphics = self.createAsset('obstacle', 'Obstacle', 0.5, 1); self.speed = -6; 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 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 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 % 120 == 0) { var obstacle = new Obstacle(); obstacle.x = game.width; obstacle.y = game.height; obstacles.push(obstacle); game.addChild(obstacle); } }); // 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 && Math.abs(swipeEnd.y - swipeStart.y) > swipeThreshold && swipeStart.y > swipeEnd.y) { hero.jump(); } swipeStart = null; // Reset swipe start position });
===================================================================
--- original.js
+++ change.js
@@ -20,15 +20,8 @@
self.y = game.height - heroGraphics.height / 2;
}
}
};
- self.land = function () {
- if (self.isJumping) {
- self.velocityY = 0; // Reset vertical velocity
- self.y = game.height - heroGraphics.height / 2; // Position hero at the bottom
- self.isJumping = false; // Stop jumping
- }
- };
self.jump = function () {
if (!self.isJumping) {
self.isJumping = true;
self.velocityY = self.jumpPower;
@@ -113,30 +106,24 @@
obstacles.push(obstacle);
game.addChild(obstacle);
}
});
-var startTouchY = 0;
-var isSwiping = false;
-// Touch start event to initiate swipe detection
+// 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 touchPos = obj.event.getLocalPosition(game);
- startTouchY = touchPos.y;
- isSwiping = true;
+ var event = obj.event;
+ swipeStart = event.getLocalPosition(game);
});
-// Touch move event to detect swipe gesture
-game.on('move', function (obj) {
- if (isSwiping) {
- var touchPos = obj.event.getLocalPosition(game);
- if (touchPos.y - startTouchY > 50) {
- // Swipe up detected
- hero.jump();
- isSwiping = false;
- }
- }
-});
-
-// Touch end event to reset swipe detection
+// Touch end event to detect a swipe
game.on('up', function (obj) {
- isSwiping = false;
+ var event = obj.event;
+ var swipeEnd = event.getLocalPosition(game);
+ if (swipeStart && Math.abs(swipeEnd.y - swipeStart.y) > swipeThreshold && swipeStart.y > swipeEnd.y) {
+ hero.jump();
+ }
+ swipeStart = null; // Reset swipe start position
});
\ No newline at end of file