User prompt
güneşin animasyonunu kaldır
User prompt
güneş sarı olarak parlasın ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
ölümsesini akldır
User prompt
ölüm sesi yap
User prompt
ölümsesinin aktar
User prompt
ölüm sesi ekle
User prompt
puğan sesini kaldır
User prompt
ölümsesini kaldır
User prompt
her 1000 puğan olunca ses gelsin
User prompt
ölüm sesi ekle
User prompt
dryy sil
User prompt
duckı sil
Code edit (1 edits merged)
Please save this source code
User prompt
güneşi sol üster al
User prompt
güneşi asıcık sağ alta al
User prompt
güneşi sola al
User prompt
güneşi bi tık sağ aşşağığa al
User prompt
sağ yukarı güneş ekle
User prompt
gece ve gündüz döngüsünü kaldır
User prompt
ayı kladır
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.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; // Add floating animation to clouds tween(cloudGraphics, { y: -10 }, { duration: 2000, easing: tween.easeInOut, onFinish: function onFinish() { tween(cloudGraphics, { y: 10 }, { duration: 2000, easing: tween.easeInOut, onFinish: function onFinish() { tween(cloudGraphics, { y: 0 }, { duration: 2000, easing: tween.easeInOut }); } }); } }); 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.normalHeight = 80; self.duckHeight = 40; self.jump = function () { if (!self.isJumping && !self.isDucking) { self.isJumping = true; self.jumpSpeed = self.jumpPower; LK.getSound('jump').play(); // Add bounce animation to dinosaur graphics tween(dinoGraphics, { scaleX: 1.2, scaleY: 0.8 }, { duration: 100, easing: tween.easeOut, onFinish: function onFinish() { tween(dinoGraphics, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100, easing: tween.easeIn }); } }); } }; self.startDuck = function () { if (!self.isJumping && !self.isDucking) { self.isDucking = true; dinoGraphics.height = self.duckHeight; LK.getSound('duck').play(); // Add squash animation when ducking tween(dinoGraphics, { scaleX: 1.3, scaleY: 0.6 }, { duration: 150, easing: tween.easeOut }); } }; self.stopDuck = function () { if (self.isDucking) { self.isDucking = false; dinoGraphics.height = self.normalHeight; // Return to normal scale when stopping duck tween(dinoGraphics, { scaleX: 1.0, scaleY: 1.0 }, { duration: 150, easing: tween.easeIn }); } }; 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; var lastMilestoneScore = 0; // Day/night cycle variables var isDay = true; var dayNightTimer = 0; var dayNightDuration = 1200; // 20 seconds at 60fps for slower transitions // Create sun in background var sun = game.addChild(LK.getAsset('sun', { anchorX: 0.5, anchorY: 0.5, x: 400, y: 500 })); // 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 = 2048 / 2; // Center horizontally on screen dinosaur.y = groundLevel; dinosaur.groundY = groundLevel; dinosaur.jumpPower = -19; // Set jump power for higher jumps // Create score display var scoreText = new Text2('0', { size: 60, fill: 0x000000 }); scoreText.anchor.set(1, 0); LK.gui.topRight.addChild(scoreText); // Create high score display var highScore = storage.highScore || 0; var highScoreText = new Text2('highest score: ' + highScore, { size: 40, fill: 0x666666 }); highScoreText.anchor.set(1, 0); highScoreText.y = 70; LK.gui.topRight.addChild(highScoreText); // 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.85 ? 'cactus' : 'pterodactyl'; if (obstacleType === 'cactus') { // Spawn 1, 2, or 3 cacti randomly var cactusCount = Math.floor(Math.random() * 3) + 1; // 1, 2, or 3 var baseX = 2048 + 50; for (var k = 0; k < cactusCount; k++) { var obstacle = new Obstacle(obstacleType); obstacle.x = baseX + k * 80; // Space cacti 80 pixels apart obstacle.speed = gameSpeed; // Add random scale variation to make some cacti smaller var randomScale = 0.6 + Math.random() * 0.4; // Scale between 0.6 and 1.0 tween(obstacle, { scaleX: randomScale, scaleY: randomScale }, { duration: 0 }); obstacles.push(obstacle); game.addChild(obstacle); } } else { // Single 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; var currentScore = Math.floor(distance); LK.setScore(currentScore); scoreText.setText(currentScore); // Update high score if current score is higher if (currentScore > highScore) { highScore = currentScore; storage.highScore = highScore; highScoreText.setText('en yüksek skor: ' + highScore); } // Check for score milestones (every 100 points) var currentScore = Math.floor(distance); var currentMilestone = Math.floor(currentScore / 100) * 100; var lastMilestone = Math.floor(lastMilestoneScore / 100) * 100; if (currentMilestone > lastMilestone && currentMilestone > 0) { LK.getSound('dryy').play(); } lastMilestoneScore = currentScore; // Increase game speed gradually gameSpeed += speedIncrease; // Update day/night cycle dayNightTimer++; if (dayNightTimer >= dayNightDuration) { dayNightTimer = 0; isDay = !isDay; if (isDay) { // Switch to day tween(game, { backgroundColor: 0x87CEEB }, { duration: 4000 }); // Sun rises slowly in an arc from left to center sun.visible = true; tween(sun, { x: 1024, y: 300, alpha: 1 }, { duration: 4000, easing: tween.easeInOut }); } else { // Switch to night tween(game, { backgroundColor: 0x1a1a2e }, { duration: 4000 }); // Sun sets slowly in an arc from center to right tween(sun, { x: 1648, y: 2732 + 150, alpha: 0 }, { duration: 4000, easing: tween.easeInOut, onFinish: function onFinish() { sun.visible = false; sun.x = 400; // Reset sun position for next cycle } }); // Darken the entire game during night tween(game, { backgroundColor: 0x0f0f23 }, { duration: 2000, easing: tween.easeInOut }); } } // 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); } } };
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.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;
// Add floating animation to clouds
tween(cloudGraphics, {
y: -10
}, {
duration: 2000,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(cloudGraphics, {
y: 10
}, {
duration: 2000,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(cloudGraphics, {
y: 0
}, {
duration: 2000,
easing: tween.easeInOut
});
}
});
}
});
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.normalHeight = 80;
self.duckHeight = 40;
self.jump = function () {
if (!self.isJumping && !self.isDucking) {
self.isJumping = true;
self.jumpSpeed = self.jumpPower;
LK.getSound('jump').play();
// Add bounce animation to dinosaur graphics
tween(dinoGraphics, {
scaleX: 1.2,
scaleY: 0.8
}, {
duration: 100,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(dinoGraphics, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 100,
easing: tween.easeIn
});
}
});
}
};
self.startDuck = function () {
if (!self.isJumping && !self.isDucking) {
self.isDucking = true;
dinoGraphics.height = self.duckHeight;
LK.getSound('duck').play();
// Add squash animation when ducking
tween(dinoGraphics, {
scaleX: 1.3,
scaleY: 0.6
}, {
duration: 150,
easing: tween.easeOut
});
}
};
self.stopDuck = function () {
if (self.isDucking) {
self.isDucking = false;
dinoGraphics.height = self.normalHeight;
// Return to normal scale when stopping duck
tween(dinoGraphics, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 150,
easing: tween.easeIn
});
}
};
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;
var lastMilestoneScore = 0;
// Day/night cycle variables
var isDay = true;
var dayNightTimer = 0;
var dayNightDuration = 1200; // 20 seconds at 60fps for slower transitions
// Create sun in background
var sun = game.addChild(LK.getAsset('sun', {
anchorX: 0.5,
anchorY: 0.5,
x: 400,
y: 500
}));
// 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 = 2048 / 2; // Center horizontally on screen
dinosaur.y = groundLevel;
dinosaur.groundY = groundLevel;
dinosaur.jumpPower = -19; // Set jump power for higher jumps
// Create score display
var scoreText = new Text2('0', {
size: 60,
fill: 0x000000
});
scoreText.anchor.set(1, 0);
LK.gui.topRight.addChild(scoreText);
// Create high score display
var highScore = storage.highScore || 0;
var highScoreText = new Text2('highest score: ' + highScore, {
size: 40,
fill: 0x666666
});
highScoreText.anchor.set(1, 0);
highScoreText.y = 70;
LK.gui.topRight.addChild(highScoreText);
// 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.85 ? 'cactus' : 'pterodactyl';
if (obstacleType === 'cactus') {
// Spawn 1, 2, or 3 cacti randomly
var cactusCount = Math.floor(Math.random() * 3) + 1; // 1, 2, or 3
var baseX = 2048 + 50;
for (var k = 0; k < cactusCount; k++) {
var obstacle = new Obstacle(obstacleType);
obstacle.x = baseX + k * 80; // Space cacti 80 pixels apart
obstacle.speed = gameSpeed;
// Add random scale variation to make some cacti smaller
var randomScale = 0.6 + Math.random() * 0.4; // Scale between 0.6 and 1.0
tween(obstacle, {
scaleX: randomScale,
scaleY: randomScale
}, {
duration: 0
});
obstacles.push(obstacle);
game.addChild(obstacle);
}
} else {
// Single 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;
var currentScore = Math.floor(distance);
LK.setScore(currentScore);
scoreText.setText(currentScore);
// Update high score if current score is higher
if (currentScore > highScore) {
highScore = currentScore;
storage.highScore = highScore;
highScoreText.setText('en yüksek skor: ' + highScore);
}
// Check for score milestones (every 100 points)
var currentScore = Math.floor(distance);
var currentMilestone = Math.floor(currentScore / 100) * 100;
var lastMilestone = Math.floor(lastMilestoneScore / 100) * 100;
if (currentMilestone > lastMilestone && currentMilestone > 0) {
LK.getSound('dryy').play();
}
lastMilestoneScore = currentScore;
// Increase game speed gradually
gameSpeed += speedIncrease;
// Update day/night cycle
dayNightTimer++;
if (dayNightTimer >= dayNightDuration) {
dayNightTimer = 0;
isDay = !isDay;
if (isDay) {
// Switch to day
tween(game, {
backgroundColor: 0x87CEEB
}, {
duration: 4000
});
// Sun rises slowly in an arc from left to center
sun.visible = true;
tween(sun, {
x: 1024,
y: 300,
alpha: 1
}, {
duration: 4000,
easing: tween.easeInOut
});
} else {
// Switch to night
tween(game, {
backgroundColor: 0x1a1a2e
}, {
duration: 4000
});
// Sun sets slowly in an arc from center to right
tween(sun, {
x: 1648,
y: 2732 + 150,
alpha: 0
}, {
duration: 4000,
easing: tween.easeInOut,
onFinish: function onFinish() {
sun.visible = false;
sun.x = 400; // Reset sun position for next cycle
}
});
// Darken the entire game during night
tween(game, {
backgroundColor: 0x0f0f23
}, {
duration: 2000,
easing: tween.easeInOut
});
}
}
// 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);
}
}
};
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