User prompt
кнопки нажимаются не с первого раза
User prompt
Please fix the bug: 'Uncaught TypeError: LK.showPauseMenu is not a function' in or related to this line: 'LK.showPauseMenu();' Line Number: 125
User prompt
Please fix the bug: 'Uncaught TypeError: LK.pause is not a function' in or related to this line: 'LK.pause();' Line Number: 125
User prompt
проверь код на ошибки, игра не запускается
User prompt
Please fix the bug: 'Uncaught TypeError: game.pause is not a function' in or related to this line: 'game.pause();' Line Number: 125
User prompt
Please fix the bug: 'easyButton is not defined' in or related to this line: 'easyButton.down = function (x, y, obj) {' Line Number: 50
User prompt
перенеси кнопки уровня в меню паузы
User prompt
кнопок нет
User prompt
вначале игра должна стоять на паузе, но после нажатия кнопку уровня игра начинается
User prompt
всё равно кнопки не работають
User prompt
кнопки не раюотают
User prompt
отмени моё предыдущее действие
User prompt
Please fix the bug: 'Uncaught TypeError: LK.pauseGame is not a function' in or related to this line: 'LK.pauseGame();' Line Number: 59
User prompt
отлично, сделай так, чтобы при выборе уровня игра ставилась на паузу
User prompt
кнопка выбора сложности не работает, сделай 3 кнопки с выбором сложности, при клике на них уровень должен измениться на тот, который соответсвует кнопке. Также добавь анимацию нажатия на кнопку, предыдущую кнопку нужно уюрать
User prompt
добавь меню с выбор сложности, чем сложнее уровень, тем больше препятствий
User prompt
исправь все ошибки, курсор работает неправильно
Initial prompt
Money
===================================================================
--- original.js
+++ change.js
@@ -1,66 +1,67 @@
-/****
+/****
* Classes
-****/
+****/
//<Assets used in the game will automatically appear here>
// Coin class
var Coin = Container.expand(function () {
- var self = Container.call(this);
- var coinGraphics = self.attachAsset('coin', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.update = function () {
- self.y += 5; // Move coin downwards
- if (self.y > 2732) {
- self.destroy();
- }
- };
+ var self = Container.call(this);
+ var coinGraphics = self.attachAsset('coin', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.update = function () {
+ self.y += 5; // Move coin downwards
+ if (self.y > 2732) {
+ self.destroy();
+ }
+ };
});
// Obstacle class
var Obstacle = Container.expand(function () {
- var self = Container.call(this);
- var obstacleGraphics = self.attachAsset('obstacle', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.update = function () {
- self.y += 7; // Move obstacle downwards
- if (self.y > 2732) {
- self.destroy();
- }
- };
+ var self = Container.call(this);
+ var obstacleGraphics = self.attachAsset('obstacle', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.update = function () {
+ self.y += 7; // Move obstacle downwards
+ if (self.y > 2732) {
+ self.destroy();
+ }
+ };
});
// Player class
var Player = Container.expand(function () {
- var self = Container.call(this);
- var playerGraphics = self.attachAsset('player', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.move = function (x, y, obj) {
- self.x = x;
- self.y = y;
- };
+ var self = Container.call(this);
+ var playerGraphics = self.attachAsset('player', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.move = function (x, y, obj) {
+ var game_position = game.toLocal(obj.global);
+ self.x = game_position.x;
+ self.y = game_position.y;
+ };
});
-/****
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000 //Init game with black background
+ backgroundColor: 0x000000 //Init game with black background
});
-/****
+/****
* Game Code
-****/
+****/
// Initialize arrays and variables
var coins = [];
var obstacles = [];
var score = 0;
var scoreTxt = new Text2('0', {
- size: 150,
- fill: "#ffffff"
+ size: 150,
+ fill: "#ffffff"
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Create player
@@ -68,47 +69,47 @@
player.x = 2048 / 2;
player.y = 2732 - 200;
// Handle move events
game.move = function (x, y, obj) {
- player.move(x, y, obj);
+ player.move(x, y, obj);
};
// Update game logic
game.update = function () {
- // Update coins
- for (var i = coins.length - 1; i >= 0; i--) {
- if (coins[i].intersects(player)) {
- score += 1;
- scoreTxt.setText(score);
- coins[i].destroy();
- coins.splice(i, 1);
- } else if (coins[i].y > 2732) {
- coins[i].destroy();
- coins.splice(i, 1);
- }
- }
- // Update obstacles
- for (var i = obstacles.length - 1; i >= 0; i--) {
- if (obstacles[i].intersects(player)) {
- LK.effects.flashScreen(0xff0000, 1000);
- LK.showGameOver();
- } else if (obstacles[i].y > 2732) {
- obstacles[i].destroy();
- obstacles.splice(i, 1);
- }
- }
- // Spawn coins
- if (LK.ticks % 60 == 0) {
- var newCoin = new Coin();
- newCoin.x = Math.random() * 2048;
- newCoin.y = -50;
- coins.push(newCoin);
- game.addChild(newCoin);
- }
- // Spawn obstacles
- if (LK.ticks % 90 == 0) {
- var newObstacle = new Obstacle();
- newObstacle.x = Math.random() * 2048;
- newObstacle.y = -50;
- obstacles.push(newObstacle);
- game.addChild(newObstacle);
- }
+ // Update coins
+ for (var i = coins.length - 1; i >= 0; i--) {
+ if (coins[i].intersects(player)) {
+ score += 1;
+ scoreTxt.setText(score);
+ coins[i].destroy();
+ coins.splice(i, 1);
+ } else if (coins[i].y > 2732) {
+ coins[i].destroy();
+ coins.splice(i, 1);
+ }
+ }
+ // Update obstacles
+ for (var i = obstacles.length - 1; i >= 0; i--) {
+ if (obstacles[i].intersects(player)) {
+ LK.effects.flashScreen(0xff0000, 1000);
+ LK.showGameOver();
+ } else if (obstacles[i].y > 2732) {
+ obstacles[i].destroy();
+ obstacles.splice(i, 1);
+ }
+ }
+ // Spawn coins
+ if (LK.ticks % 60 == 0) {
+ var newCoin = new Coin();
+ newCoin.x = Math.random() * 2048;
+ newCoin.y = -50;
+ coins.push(newCoin);
+ game.addChild(newCoin);
+ }
+ // Spawn obstacles
+ if (LK.ticks % 90 == 0) {
+ var newObstacle = new Obstacle();
+ newObstacle.x = Math.random() * 2048;
+ newObstacle.y = -50;
+ obstacles.push(newObstacle);
+ game.addChild(newObstacle);
+ }
};
\ No newline at end of file