User prompt
The scoring gets stuck when it reaches 15-17 points. The score should continue to accumulate until the player loses.
User prompt
The punctuation text and the score don't increase correctly; after 15 points, it stops increasing normally. The score increases by 1 when the player dodges an obstacle.
User prompt
Update the punctuation text so that the correct live punctuation is displayed.
User prompt
From the score of 15 onwards, the counting starts incorrectly; remember that an obstacle that comes off the map adds 1 to the score.
User prompt
The score count is stuck at 15, fix it.
User prompt
Move the score record just below the score
User prompt
The score record isn't showing up either; make it appear below the score.
User prompt
The score is not displayed at the top of the screen
User prompt
Add the live score at the top, and the player's high score at the bottom. ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
make it a little bigger
User prompt
Make the collisions smaller, especially those with obstacles and motorcyclists, because sometimes it's impossible to play.
User prompt
Okay, now make the image of the motorcyclist fit with his collision.
User prompt
Okay, the obstacles are too big, make them smaller.
User prompt
The collision of the obstacles does not match the one in the image, make it match.
User prompt
The obstacle must be smaller at the beginning of the game. As the player's score increases, the obstacle will grow and its speed will gradually increase. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
The "obstacle" image must be the same size as the "obstacle" collision.
User prompt
Make the size of the motorcyclist collision and texture 800x800
User prompt
Now the size of the motorcyclist increases slightly, making him a little smaller than the obstacles.
User prompt
The collisions keep failing, even if the motorcyclist doesn't touch the obstacles, the defeat screen appears, fix it please.
User prompt
The collisions are still failing, can you remove the new texture and add the old one back?
User prompt
You can move the motorcyclist forward a little, so that he is a little more in the middle.
User prompt
When you add a texture to the "obstacle", collisions start to fail; you could fix the collisions so that the texture matches the collision.
User prompt
The character still can't go any further; they should be able to move around the entire map.
User prompt
The movement must be all over the map; the motorcyclist will move using the mouse, and the movement must be linked to where the mouse is pointing.
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'addEventListener')' in or related to this line: 'document.addEventListener('keydown', function (event) {' Line Number: 114
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var Motorcycle = Container.expand(function () {
var self = Container.call(this);
var motorcycleGraphics = self.attachAsset('motorcycle', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 4.0,
scaleY: 5.33
});
self.speed = 15;
self.moveLeft = false;
self.moveRight = false;
self.moveBackward = false;
self.moveForward = true;
self.laneWidth = 512;
self.currentLane = 1;
self.minX = 256;
self.maxX = 1792;
self.velocity = {
x: 0,
y: 0
};
self.update = function () {};
return self;
});
var Obstacle = Container.expand(function () {
var self = Container.call(this);
var obstacleGraphics = self.attachAsset('obstacle', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 2.67,
scaleY: 3.54
});
self.baseSpeed = 12;
self.speed = 12;
self.lastY = self.y;
self.setDifficulty = function (difficultyLevel) {
self.speed = self.baseSpeed + (difficultyLevel - 1) * 2;
};
self.update = function () {
self.lastY = self.y;
self.y += self.speed;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x1a1a1a
});
/****
* Game Code
****/
var roadGraphic = LK.getAsset('road', {
anchorX: 0.5,
anchorY: 0.0
});
roadGraphic.x = 1024;
roadGraphic.y = 0;
game.addChild(roadGraphic);
var motorcycle = game.addChild(new Motorcycle());
motorcycle.x = 1024;
motorcycle.y = 2000;
var obstacles = [];
var score = 0;
var distance = 0;
var gameActive = true;
var spawnRate = 60;
var spawnCounter = 0;
var difficulty = 1;
var scoreTxt = new Text2('Score: 0', {
size: 100,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
scoreTxt.x = 1024;
scoreTxt.y = 50;
LK.gui.top.addChild(scoreTxt);
var lanePositions = [256, 768, 1280, 1792];
game.move = function (x, y, obj) {
if (!gameActive) return;
var targetX = x;
targetX = Math.max(motorcycle.minX, Math.min(motorcycle.maxX, targetX));
motorcycle.velocity.x = (targetX - motorcycle.x) * 0.15;
motorcycle.x += motorcycle.velocity.x;
};
game.update = function () {
if (!gameActive) return;
motorcycle.update();
spawnCounter++;
if (spawnCounter >= Math.max(30, spawnRate - Math.floor(difficulty))) {
spawnCounter = 0;
var randomLane = Math.floor(Math.random() * 4);
var newObstacle = new Obstacle();
newObstacle.x = lanePositions[randomLane];
newObstacle.y = -100;
newObstacle.lastY = newObstacle.y;
newObstacle.lastWasColliding = false;
newObstacle.setDifficulty(difficulty);
obstacles.push(newObstacle);
game.addChild(newObstacle);
LK.getSound('whoosh').play();
}
distance++;
difficulty = 1 + Math.floor(distance / 500);
scoreTxt.setText('Score: ' + score);
for (var i = obstacles.length - 1; i >= 0; i--) {
var obstacle = obstacles[i];
obstacle.update();
if (obstacle.lastY <= 2732 && obstacle.y > 2732) {
obstacle.destroy();
obstacles.splice(i, 1);
score++;
scoreTxt.setText('Score: ' + score);
continue;
}
var isColliding = motorcycle.intersects(obstacle);
if (!obstacle.lastWasColliding && isColliding) {
gameActive = false;
LK.getSound('crash').play();
LK.effects.flashScreen(0xFF0000, 500);
LK.setScore(score);
LK.showGameOver();
return;
}
obstacle.lastWasColliding = isColliding;
}
}; ===================================================================
--- original.js
+++ change.js
@@ -34,9 +34,11 @@
var Obstacle = Container.expand(function () {
var self = Container.call(this);
var obstacleGraphics = self.attachAsset('obstacle', {
anchorX: 0.5,
- anchorY: 0.5
+ anchorY: 0.5,
+ scaleX: 2.67,
+ scaleY: 3.54
});
self.baseSpeed = 12;
self.speed = 12;
self.lastY = self.y;