User prompt
Если игрок пересек объект prep или pref, то game over
User prompt
Если игрок пересек объекты prep и prepf, то game over
Code edit (1 edits merged)
Please save this source code
User prompt
Если игрок пересекается с prep1 gameover
User prompt
как изменить высоту прыжка, сейчас по X улетает высоко, нужно ниже
User prompt
как изменить высоту прыжка, сейчас по X улетает высоко, нужно ниже
User prompt
исправь это
User prompt
уменьшить высоту прыжка
User prompt
Уменьшить высоту прыжка
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'tween(player, {' Line Number: 78 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'Timeout.tick error: Can't find variable: tween' in or related to this line: 'tween(ball, {' Line Number: 564 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Сделай свои рекомендации
User prompt
Проверять пересечения child и prep
User prompt
Проверять столкновения в радиусе объекта character и prep
User prompt
При столкновении characterи prep game over
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'if (!player.inAir && !player.doubleJump) {' Line Number: 98
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'if (!player.inAir && !player.doubleJump) {' Line Number: 60
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'if (!player.doubleJump || player.inAir && !player.doubleJump) {' Line Number: 122
User prompt
Please fix the bug: 'Timeout.tick error: Can't find variable: player' in or related to this line: 'game.setChildIndex(player, game.children.length - 1); // Move player to the top' Line Number: 376
User prompt
Please fix the bug: 'Timeout.tick error: Can't find variable: player' in or related to this line: 'game.setChildIndex(player, game.children.length - 1); // Move player to the top' Line Number: 376
User prompt
Сделать объект character основным игроком, с которым в будущем будем сравнивать столкновения с другими объектами
User prompt
Усложни игру еще
User prompt
Усложни игру
User prompt
Сделать проверку на столкновения объекта character и prep
User prompt
Сделать проверку на столкновения объекта character и prep
===================================================================
--- original.js
+++ change.js
@@ -140,22 +140,8 @@
self.isPressed = false; // Reset pressed state
self.scale.set(1); // Reset scale to original size
};
});
-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', {
@@ -169,22 +155,8 @@
// Initialize lastY and lastX for tracking changes
self.lastY = self.y;
self.lastX = self.x;
});
-var PowerUp = Container.expand(function () {
- var self = Container.call(this);
- var powerUpGraphics = self.attachAsset('Uskorenie', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.speed = 3;
- self.update = function () {
- self.x -= self.speed;
- if (self.x < -self.width / 2) {
- self.destroy();
- }
- };
-});
/****
* Initialize Game
****/
@@ -546,12 +518,12 @@
}
});
}, 1500);
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
-player.rotation = Math.PI / 12; // Set initial rotation to 15 degrees clockwise
+var character = game.addChild(new Player());
+character.x = character.width / 2 + 200; // Position character 200 units to the right of the center left of the screen
+character.y = 2732 / 2 - 250; // Move character 150 units down
+character.rotation = Math.PI / 12; // Set initial rotation to 15 degrees clockwise
// Add background to the game
var background = game.addChild(LK.getAsset('background_1', {
anchorX: 0.5,
anchorY: 0.5
@@ -620,72 +592,61 @@
return;
}
buttonTop.interactive = true;
buttonBot.interactive = true;
- // Update lastY and lastX for player
- player.lastY = player.y;
- player.lastX = player.x;
+ // Update lastY and lastX for character
+ character.lastY = character.y;
+ character.lastX = character.x;
game.children.forEach(function (child) {
- if (child !== player && child !== buttonTop && child !== buttonBot && child !== uskorenie) {
- // Check for intersection with prep or prepf objects
- if ((prepImages.includes(child.assetId) || prepFImages.includes(child.assetId)) && player.intersects(child)) {
- LK.setScore(LK.getScore() + 1); // Increment score
- scoreText.setText(LK.getScore().toString()); // Update score display
+ if (child !== character && child !== buttonTop && child !== buttonBot && child !== uskorenie) {
+ // Check for intersection with prep or prepf objects
+ if ((prepImages.includes(child.assetId) || prepFImages.includes(child.assetId)) && character.intersects(child)) {
+ LK.setScore(LK.getScore() + 1); // Increment score
+ scoreText.setText(LK.getScore().toString()); // Update score display
}
if (child === domImage) {
if (child.lastX === undefined) {
child.lastX = child.x;
}
if (child.lastY === undefined) {
child.lastY = child.y;
}
- child.x -= 3 * Math.cos(child.rotation); // Set speed for domImage
- child.y -= 3 * Math.sin(child.rotation); // Set speed for domImage
+ child.x -= 3 * Math.cos(child.rotation); // Set speed for domImage
+ child.y -= 3 * Math.sin(child.rotation); // Set speed for domImage
child.lastX = child.x;
child.lastY = child.y;
} else if (domImages.includes(child)) {
- child.x -= 3 * Math.cos(child.rotation); // Set speed for newDom images
- child.y -= 3 * Math.sin(child.rotation); // Set speed for newDom images
+ child.x -= 3 * Math.cos(child.rotation); // Set speed for newDom images
+ child.y -= 3 * Math.sin(child.rotation); // Set speed for newDom images
} else {
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'
+ 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 -= otherImageSpeed * Math.cos(child.rotation); // Apply increased speed for other images
- child.y -= otherImageSpeed * Math.sin(child.rotation); // Apply increased speed for other images
+ child.x -= otherImageSpeed * Math.cos(child.rotation); // Apply increased speed for other images
+ child.y -= otherImageSpeed * Math.sin(child.rotation); // Apply increased speed for other images
}
}
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
- child.destroy(); // Remove the image
+ // If the image is completely off the screen
+ child.destroy(); // Remove the image
}
}
game.setChildIndex(player, game.children.length - 1); // Move player to the top
game.setChildIndex(buttonBot, game.children.length - 1); // Ensure buttonBot is on top
game.setChildIndex(buttonTop, game.children.length - 1); // Ensure buttonTop is on top
});
- // Add shaking effect to the player
+ // Add shaking effect to the character
if (gameStarted) {
if (LK.ticks < 130) {
- // Strong shake for the first second (assuming 60 FPS)
- player.x = player.lastX + Math.sin(LK.ticks / 0.5) * 10;
- player.y = player.lastY + Math.cos(LK.ticks / 0.5) * 10;
+ // Strong shake for the first second (assuming 60 FPS)
+ character.x = character.lastX + Math.sin(LK.ticks / 0.5) * 10;
+ character.y = character.lastY + Math.cos(LK.ticks / 0.5) * 10;
} else {
- player.x = player.lastX + Math.sin(LK.ticks / 0.5) * 3;
- player.y = player.lastY + Math.cos(LK.ticks / 0.5) * 3;
+ character.x = character.lastX + Math.sin(LK.ticks / 0.5) * 3;
+ character.y = character.lastY + Math.cos(LK.ticks / 0.5) * 3;
}
if (vzriv && vzriv.parent) {
vzriv.destroy();
}
}
- // Create obstacles at random intervals
- if (Math.random() < 0.01) {
- var obstacle = game.addChild(new Obstacle());
- obstacle.x = 2048 + obstacle.width / 2;
- obstacle.y = Math.random() * 2732;
- }
- if (Math.random() < 0.005) {
- var powerUp = game.addChild(new PowerUp());
- powerUp.x = 2048 + powerUp.width / 2;
- powerUp.y = Math.random() * 2732;
- }
};
\ No newline at end of file
создать мультяшного сидячего персонажа. 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