User prompt
puğanı piksel yap
User prompt
harf ve sayıları piksele cevir
User prompt
sağ üsteki sayacı piksel yap
User prompt
Please fix the bug: 'Cannot set properties of undefined (setting 'fontFamily')' in or related to this line: 'scoreText.style.fontFamily = "monospace";' Line Number: 138
User prompt
Sağdaki sayıları piksellendirin
Code edit (1 edits merged)
Please save this source code
User prompt
Dino Run: Endless Obstacle Course
Initial prompt
dinosaur game
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Cloud = Container.expand(function () { var self = Container.call(this); var cloudGraphics = self.attachAsset('cloud', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 2; self.update = function () { self.x -= self.speed; }; return self; }); var Dinosaur = Container.expand(function () { var self = Container.call(this); var dinoGraphics = self.attachAsset('dino', { anchorX: 0.5, anchorY: 1.0 }); self.isJumping = false; self.isDucking = false; self.groundY = 0; self.jumpSpeed = 0; self.gravity = 0.8; self.jumpPower = -16; self.normalHeight = 80; self.duckHeight = 40; self.jump = function () { if (!self.isJumping && !self.isDucking) { self.isJumping = true; self.jumpSpeed = self.jumpPower; LK.getSound('jump').play(); } }; self.startDuck = function () { if (!self.isJumping && !self.isDucking) { self.isDucking = true; dinoGraphics.height = self.duckHeight; LK.getSound('duck').play(); } }; self.stopDuck = function () { if (self.isDucking) { self.isDucking = false; dinoGraphics.height = self.normalHeight; } }; self.update = function () { if (self.isJumping) { self.jumpSpeed += self.gravity; self.y += self.jumpSpeed; if (self.y >= self.groundY) { self.y = self.groundY; self.isJumping = false; self.jumpSpeed = 0; } } }; return self; }); var Obstacle = Container.expand(function (type) { var self = Container.call(this); self.type = type; self.speed = 8; if (type === 'cactus') { var obstacleGraphics = self.attachAsset('cactus', { anchorX: 0.5, anchorY: 1.0 }); self.y = groundLevel; } else if (type === 'pterodactyl') { var obstacleGraphics = self.attachAsset('pterodactyl', { anchorX: 0.5, anchorY: 0.5 }); self.y = groundLevel - 120; } self.update = function () { self.x -= self.speed; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB }); /**** * Game Code ****/ var groundLevel = 2732 - 200; var gameSpeed = 8; var speedIncrease = 0.005; var distance = 0; var isGameRunning = true; var isDucking = false; // Create ground var ground = game.addChild(LK.getAsset('ground', { anchorX: 0, anchorY: 0, x: 0, y: groundLevel })); // Create dinosaur var dinosaur = game.addChild(new Dinosaur()); dinosaur.x = 300; dinosaur.y = groundLevel; dinosaur.groundY = groundLevel; // Create score display var scoreText = new Text2('0', { size: 60, fill: 0x000000, font: "monospace" }); scoreText.anchor.set(1, 0); LK.gui.topRight.addChild(scoreText); // Arrays for game objects var obstacles = []; var clouds = []; // Obstacle spawning variables var obstacleSpawnTimer = 0; var obstacleSpawnDelay = 120; var cloudSpawnTimer = 0; var cloudSpawnDelay = 200; // Input handling game.down = function (x, y, obj) { if (isGameRunning) { dinosaur.jump(); isDucking = true; dinosaur.startDuck(); } }; game.up = function (x, y, obj) { if (isGameRunning) { isDucking = false; dinosaur.stopDuck(); } }; // Spawn obstacle function function spawnObstacle() { var obstacleType = Math.random() < 0.7 ? 'cactus' : 'pterodactyl'; var obstacle = new Obstacle(obstacleType); obstacle.x = 2048 + 50; obstacle.speed = gameSpeed; obstacles.push(obstacle); game.addChild(obstacle); } // Spawn cloud function function spawnCloud() { var cloud = new Cloud(); cloud.x = 2048 + 50; cloud.y = Math.random() * 400 + 100; cloud.speed = gameSpeed * 0.3; clouds.push(cloud); game.addChild(cloud); } // Main game loop game.update = function () { if (!isGameRunning) return; // Update distance and score distance += gameSpeed * 0.1; LK.setScore(Math.floor(distance)); scoreText.setText(Math.floor(distance)); // Increase game speed gradually gameSpeed += speedIncrease; // Spawn obstacles obstacleSpawnTimer++; if (obstacleSpawnTimer >= obstacleSpawnDelay) { spawnObstacle(); obstacleSpawnTimer = 0; obstacleSpawnDelay = Math.max(60, obstacleSpawnDelay - 0.5); } // Spawn clouds cloudSpawnTimer++; if (cloudSpawnTimer >= cloudSpawnDelay) { spawnCloud(); cloudSpawnTimer = 0; } // Update and manage obstacles for (var i = obstacles.length - 1; i >= 0; i--) { var obstacle = obstacles[i]; obstacle.speed = gameSpeed; // Check collision if (dinosaur.intersects(obstacle)) { isGameRunning = false; LK.showGameOver(); return; } // Remove off-screen obstacles if (obstacle.x < -100) { obstacle.destroy(); obstacles.splice(i, 1); } } // Update and manage clouds for (var j = clouds.length - 1; j >= 0; j--) { var cloud = clouds[j]; cloud.speed = gameSpeed * 0.3; // Remove off-screen clouds if (cloud.x < -100) { cloud.destroy(); clouds.splice(j, 1); } } };
===================================================================
--- original.js
+++ change.js
@@ -119,9 +119,9 @@
// Create score display
var scoreText = new Text2('0', {
size: 60,
fill: 0x000000,
- font: "'Courier New', 'Monaco', 'Menlo', 'Consolas', monospace"
+ font: "monospace"
});
scoreText.anchor.set(1, 0);
LK.gui.topRight.addChild(scoreText);
// Arrays for game objects
sand. In-Game asset. No shadows. pixel
cloudy. In-Game asset. No shadows. pixel
cactus. No background. Transparent background. Blank background. No shadows. pixel. In-Game asset. flat
white and black dinosaur. In-Game asset. No shadows. pixel
beyaz siyah uçan dinazor kuş. In-Game asset. No shadows. pixel
güneş. In-Game asset. No shadows. pixel