User prompt
Please fix the bug: 'Cannot set properties of undefined (setting 'up')' in or related to this line: 'self.up = function (x, y, obj) {' Line Number: 199
User prompt
Если нажать button_bot когда персонаж не в прыжке, то персонаж поворачивается на 70 градусов против часовой стрелки, а как только отпускают Button_bot, то персонаж разворачивается обратно
User prompt
если персонаж в полете и нажать и удерживать кнопку button_bot, то игрок еще поворачивается на 70 градусов. При отжатии кнопки возвращается в исходное положение
Code edit (7 edits merged)
Please save this source code
User prompt
исправить ошибку, когда при приземлении, если отжать зажатую кнопку button_bot персонаж поворачивается
User prompt
пока персонаж в полете и нажать кнопку button_bot, то игрок не повернется на 70 градусов
User prompt
последнее изменение не 90 градусов, а 70
User prompt
Please fix the bug: 'Cannot set properties of undefined (setting 'up')' in or related to this line: 'self.up = function (x, y, obj) {' Line Number: 203
User prompt
Please fix the bug: 'Cannot set properties of undefined (setting 'up')' in or related to this line: 'self.up = function (x, y, obj) {' Line Number: 199
User prompt
Если нажать и удерживать button_bot когда персонаж не в прыжке, то персонаж поворачивается на 90 градусов против часовой стрелки, а как только отпускают Button_bot, то персонаж разворачивается обратно
User prompt
Если нажать на button_bot когда на первоначальной позиции, то персонаж поворачивается на 90 градусов против часовой стрелки
User prompt
Добавить событие на button_bot, если во время прыжка или double jump нажать на button_bot, то длительность приземления равна 100
Code edit (5 edits merged)
Please save this source code
User prompt
Увеличить скорость заднего фона 1
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'tween(player, {' Line Number: 57 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Условие inair должно определятся, если игрок сдвинулся от y=-1 до -300
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'tween(player, {' Line Number: 53 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Если double jump нажимают во время того, как первый прыжок не дошел до своего пика высоты, то jump отменяется и начинает срабатывать double jump
User prompt
Отменить прыжок jump и заменить его double jump, если jump не завершен
Code edit (3 edits merged)
Please save this source code
User prompt
добавить проверку, чтобы высота DOUBLE JUMP была всегда равна 400
User prompt
y: player.y - 400 высота DOUBLE JUMP должна всегда быть равно 400. ИСправить ситуацию, когда второй прыжок может быть меньше
Code edit (10 edits merged)
Please save this source code
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var ButtonBot = Container.expand(function () {
var self = Container.call(this);
var buttonBotGraphics = self.attachAsset('BUTTON_BOT', {
anchorX: 0.5,
anchorY: 0.5
});
});
// Create a button top class
var ButtonTop = Container.expand(function () {
var self = Container.call(this);
var buttonTopGraphics = self.attachAsset('BUTTON_TOP', {
anchorX: 0.5,
anchorY: 0.5
});
// Add down event to trigger jump
self.down = function (x, y, obj) {
if (!player.doubleJump) {
if (player.inAir && !player.doubleJump && player.y < 2732 / 2 - 500) {
player.doubleJump = true;
tween(player, {
y: player.y - 400,
// второй прыжок (Высота)
// Decrease the jump height by 50
rotation: player.rotation - Math.PI * 2 // Add 360-degree counter-clockwise rotation
}, {
duration: 400,
// длительность вращения, во время второго прыжка
// Further decrease the duration to increase the speed
easing: tween.easeInOut,
// Smooth easing for the rotation
onFinish: function onFinish() {
tween(player, {
y: 2732 / 2 - 250
}, {
duration: 500,
// Длительность приземления, после второго прыжка
onFinish: function onFinish() {
player.inAir = false;
player.doubleJump = false; // Reset double jump flag after landing
player.y = 2732 / 2 - 250; // Ensure player returns to original position
}
});
}
});
return;
}
player.inAir = true;
// Jump logic: move player up and then back to original position
tween(player, {
y: player.y - 300 // Decrease the jump height (ВЫСОТА ПЕРВОГО ПРЫЖКА)
}, {
duration: 300,
// скорость первого прыжка
// Further decrease the duration to increase the speed
onFinish: function onFinish() {
tween(player, {
y: 2732 / 2 - 250
}, {
duration: 500,
// Длительность приземления, после первого прыжка
onFinish: function onFinish() {
player.inAir = false;
}
});
}
});
}
};
});
// Create a player class
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.attachAsset('character', {
anchorX: 0.5,
anchorY: 0.5
});
// Initialize the inAir flag
self.inAir = false;
self.doubleJump = false;
});
/****
* Initialize Game
****/
// Add player to the game
var game = new LK.Game({
backgroundColor: 0xffffff
});
/****
* Game Code
****/
// Add player to the game
game.down = function (x, y, obj) {};
var player = game.addChild(new Player());
player.x = player.width / 2 + 200; // Position player 200 units to the right of the center left of the screen
player.y = 2732 / 2 - 250; // Move player 150 units down
// Add background to the game
var background = game.addChild(LK.getAsset('background_1', {
anchorX: 0.5,
anchorY: 0.5
}));
game.setChildIndex(background, 0); // Move background to the bottom
background.x = 2048 / 2; // Center background horizontally
background.y = 2732 / 2 + 150; // Move background down by 550 pixels
background.rotation = Math.PI / 9; // Rotate background by 20 degrees clockwise
// Move background_1 towards its left side
var backgroundCounter = 0;
var backgroundTimer = LK.setInterval(function () {
var newBackground = game.addChild(LK.getAsset('background_1', {
anchorX: 0.5,
anchorY: 0.5
}));
newBackground.x = 2048 / 2 + 2500; // Move background 2048 pixels to the right
newBackground.y = 2732 / 2 + 1060; // Move background down by 1100 pixels
newBackground.rotation = Math.PI / 9; // Rotate background by 20 degrees clockwise
backgroundCounter++;
if (backgroundCounter === 1) {
LK.clearInterval(backgroundTimer);
backgroundTimer = LK.setInterval(function () {
var newBackground = game.addChild(LK.getAsset('background_1', {
anchorX: 0.5,
anchorY: 0.5
}));
newBackground.x = 2048 / 2 + 2500; // Move background 2048 pixels to the right
newBackground.y = 2732 / 2 + 1060; // Move background down by 1100 pixels
newBackground.rotation = Math.PI / 9; // Rotate background by 20 degrees clockwise
}, 5000);
} else if (backgroundCounter === 2) {
LK.clearInterval(backgroundTimer);
backgroundTimer = LK.setInterval(function () {
var newBackground = game.addChild(LK.getAsset('background_1', {
anchorX: 0.5,
anchorY: 0.5
}));
newBackground.x = 2048 / 2 + 2500; // Move background 2048 pixels to the right
newBackground.y = 2732 / 2 + 1060; // Move background down by 1100 pixels
newBackground.rotation = Math.PI / 9; // Rotate background by 20 degrees clockwise
}, 1000);
}
}, 500);
var gameStarted = false;
var gameStartTimer = LK.setTimeout(function () {
gameStarted = true;
}, 2000);
// Add BUTTON_TOP to the game
var buttonTop = game.addChild(new ButtonTop());
buttonTop.x = 2048 - buttonTop.width / 2 - 20; // Position buttonTop 20 units to the left of the right edge of the screen
buttonTop.y = 2732 - buttonTop.height / 2 - 320; // Position buttonTop 320 units above the bottom edge of the screen
// Add BUTTON_BOT to the game
var buttonBot = game.addChild(new ButtonBot());
buttonBot.x = 2048 - buttonBot.width / 2 - 20; // Position buttonBot 20 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) {
return;
}
game.children.forEach(function (child) {
if (child !== player && child !== buttonTop && child !== buttonBot) {
child.x -= 7.5 * Math.cos(child.rotation); // Increase the speed by 1.5 times
child.y -= 7.5 * Math.sin(child.rotation); // Increase the speed by 1.5 times
if (child.x + child.width / 2 < 0) {
// If the right edge of the background is less than 0 (completely off the screen)
child.destroy(); // Remove the background
}
}
game.setChildIndex(player, game.children.length - 1); // Move player to the top
});
// Add shaking effect to the player
if (gameStarted) {
player.x += Math.sin(LK.ticks / 0.5) * 3;
player.y += Math.cos(LK.ticks / 0.5) * 3;
}
};
создать мультяшного сидячего персонажа. 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