User prompt
Исправить ошибку, когда двойной прыжок не подбрасывает на на нужную высоту
Code edit (3 edits merged)
Please save this source code
User prompt
Удалить разворот на 360 градусов в двойном прыжке
Code edit (3 edits merged)
Please save this source code
User prompt
Каждые 7 секунд картинка 123 уменьшает set interval на 50. Например сейчас 2400, через 7 секунд будет 2350 и потом через еще 7 секунд будет 2300
User prompt
Через каждые 7 секунд увеличивается время создания нового Newimage123 на 0.2 секунды
User prompt
Newimage123 меняется время появления каждые 7 секунду на на 0.2 секунды
User prompt
Newimage123 меняется время появления каждые 7 секунду на 0020
Code edit (5 edits merged)
Please save this source code
User prompt
Ускоряться скорость у other images на 1 каждые 5 секунд
User prompt
Первые 5 изображений, всегда появляются prepimages
User prompt
Increase player speed over time to make the game more challenging
User prompt
Усложнить игру
User prompt
Увеличивать скорость изображений на 1 каждые 5 секунд
User prompt
Увеличивать скорость на 0.1 каждые 5 секунд
Code edit (1 edits merged)
Please save this source code
User prompt
Decrease the interval for prepRandomTimer every 10 seconds by 0.2 seconds
User prompt
Каждые 10 секунд, время появления у prepf и peep уменьшается на 0.1 секунду
Code edit (2 edits merged)
Please save this source code
User prompt
Добавить усложнение с prepimages и prepfimages
Code edit (9 edits merged)
Please save this source code
User prompt
Добавить prepf3 по аналогии с prepf2
Code edit (1 edits merged)
Please save this source code
User prompt
Определить начальное положение prepf1 и prepf2 в те положения где и были, а не в положение prepimages
User prompt
Исправить ошибку, после последнего изменения изображения prepf1 и prepf2 стали появляться на месте prepimages
===================================================================
--- original.js
+++ change.js
@@ -110,8 +110,23 @@
self.up = function (x, y, obj) {
self.scale.set(1); // Reset scale to original size
};
});
+// Create a new obstacle class
+var Obstacle = Container.expand(function () {
+ var self = Container.call(this);
+ var obstacleGraphics = self.attachAsset('Prep7', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 5;
+ self.update = function () {
+ self.x -= self.speed;
+ if (self.x < -self.width / 2) {
+ self.destroy();
+ }
+ };
+});
// Create a player class
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.attachAsset('character', {
@@ -136,8 +151,20 @@
/****
* Game Code
****/
+var score = 0;
+var scoreText = new Text2('Score: 0', {
+ size: 50,
+ fill: 0xFFFFFF
+});
+scoreText.anchor.set(0.5, 0);
+LK.gui.top.addChild(scoreText);
+function updateScore() {
+ score += 1;
+ scoreText.setText('Score: ' + score);
+}
+var scoreTimer = LK.setInterval(updateScore, 1000);
var oblako = game.addChild(LK.getAsset('Oblako', {
anchorX: 0.5,
anchorY: 0.5
}));
@@ -462,24 +489,8 @@
}, 800);
}
}, 400);
var gameStarted = false;
-var speedIncreaseTimer = LK.setInterval(function () {
- game.children.forEach(function (child) {
- if (child !== player && child !== buttonTop && child !== buttonBot && child !== uskorenie) {
- if (child === domImage || domImages.includes(child)) {
- child.x -= 1 * Math.cos(child.rotation); // Increase speed for domImage and newDom images
- child.y -= 1 * Math.sin(child.rotation); // Increase speed for domImage and newDom images
- } else if (child === oblako || oblakoInstances.includes(child)) {
- child.x -= 1 * Math.cos(child.rotation); // Increase speed for 'Oblako'
- child.y -= 1 * Math.sin(child.rotation); // Increase speed for 'Oblako'
- } else {
- child.x -= 1 * Math.cos(child.rotation); // Increase default speed for other images
- child.y -= 1 * Math.sin(child.rotation); // Increase default speed for other images
- }
- }
- });
-}, 5000);
var gameStartTimer = LK.setTimeout(function () {
gameStarted = true;
}, 2000);
// Add BUTTON_TOP to the game
@@ -490,8 +501,13 @@
var buttonBot = game.addChild(new ButtonBot());
buttonBot.x = 2048 - buttonBot.width / 2 - 50; // Position buttonBot 50 units to the left of the right edge of the screen
buttonBot.y = 2732 - buttonBot.height / 2 - 20; // Position buttonBot 20 units above the bottom edge of the screen
game.update = function () {
+ if (gameStarted && Math.random() < 0.01) {
+ var obstacle = game.addChild(new Obstacle());
+ obstacle.x = 2048 + obstacle.width / 2;
+ obstacle.y = Math.random() * 2732;
+ }
if (!gameStarted) {
buttonTop.interactive = false;
buttonBot.interactive = false;
return;
@@ -502,8 +518,11 @@
player.lastY = player.y;
player.lastX = player.x;
game.children.forEach(function (child) {
if (child !== player && child !== buttonTop && child !== buttonBot && child !== uskorenie) {
+ if (child instanceof Obstacle && player.intersects(child)) {
+ LK.showGameOver();
+ }
if (child === domImage) {
if (child.lastX === undefined) {
child.lastX = child.x;
}
@@ -521,10 +540,10 @@
if (child === oblako || oblakoInstances.includes(child)) {
child.x -= 1 * Math.cos(child.rotation); // Set speed for 'Oblako'
child.y -= 1 * Math.sin(child.rotation); // Set speed for 'Oblako'
} else {
- child.x -= 20 * Math.cos(child.rotation); // Default speed for other images
- child.y -= 20 * Math.sin(child.rotation); // Default speed for other images
+ child.x -= (20 + LK.ticks / 600) * Math.cos(child.rotation); // Increase speed over time
+ child.y -= (20 + LK.ticks / 600) * Math.sin(child.rotation); // Increase speed over time
}
}
if (child.y + child.height / 2 < 0 || child.x - child.width / 2 > 2048 || child.y - child.height / 2 > 2732) {
// If the image is completely off the screen
создать мультяшного сидячего персонажа. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
snowball. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
белая стрелочка вниз. Ровная. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Алмаз, мультяшный. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Скелет дракона. Мультяшный. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Ufo (летающая тарелка). Мультяшная. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Пингвин в снегу. Мультяшный. Головой в снегу. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Мультяшный рыбак зимой сидит рыбачит. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Человек летит на параплане. Мультяшный. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Куст в снегу мультяшный. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Дирижабль, мультяшный. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Рука белая. Иконка. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Монетка золотая мультяшная. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
снежинка. мультяшная. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
text: New Record! Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows