User prompt
kaktüsler bazıları küçük olsun ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (1 edits merged)
Please save this source code
User prompt
en yüksek skor yaz ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
en yüksek harfleri sil
User prompt
en yüksek puğanı gösteren sayı yap ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
her 100 puğan olunca dryy diye ses cıksın
User prompt
uçan dinazorunkanat çırpmasını kaldır
User prompt
pterodactyl e kanat cırpma animasyonu ekle ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
dinazor yürüme efektini kaldır
User prompt
dinazora yürüme animasyonu ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
dinazor azcık daha zıplasın
User prompt
dinazor zıplamasın
Code edit (1 edits merged)
Please save this source code
User prompt
dinazor zıplasın
Code edit (3 edits merged)
Please save this source code
User prompt
dinazor zıplasın
User prompt
dinazora zıplasın
Code edit (1 edits merged)
Please save this source code
User prompt
dinazor daha yukarı zıkplasın
User prompt
kaktüsler 1,2,3 cıksın
User prompt
animasyon ekle ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
kaktüsler den daha fazla çıksın
User prompt
puğanı normal tip
User prompt
puğanı piksel yap
User prompt
harf ve sayıları piksele cevir
/****
* 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;
// 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;
// Add wobble animation to pterodactyl
tween(obstacleGraphics, {
rotation: 0.1
}, {
duration: 500,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(obstacleGraphics, {
rotation: -0.1
}, {
duration: 500,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(obstacleGraphics, {
rotation: 0
}, {
duration: 500,
easing: tween.easeInOut
});
}
});
}
});
}
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;
dinosaur.jumpPower = -22; // 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);
// 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;
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;
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
@@ -106,64 +106,8 @@
easing: tween.easeIn
});
}
};
- // Initialize walking animation
- self.walkAnimationActive = false;
- self.startWalkAnimation = function () {
- if (!self.walkAnimationActive) {
- self.walkAnimationActive = true;
- self.walkCycle();
- }
- };
- self.walkCycle = function () {
- if (!self.walkAnimationActive) return;
- // Walking animation - slight bounce and rotation
- tween(dinoGraphics, {
- y: -5,
- rotation: 0.05
- }, {
- duration: 300,
- easing: tween.easeInOut,
- onFinish: function onFinish() {
- if (!self.walkAnimationActive) return;
- tween(dinoGraphics, {
- y: 5,
- rotation: -0.05
- }, {
- duration: 300,
- easing: tween.easeInOut,
- onFinish: function onFinish() {
- if (!self.walkAnimationActive) return;
- tween(dinoGraphics, {
- y: 0,
- rotation: 0
- }, {
- duration: 300,
- easing: tween.easeInOut,
- onFinish: function onFinish() {
- self.walkCycle(); // Loop the animation
- }
- });
- }
- });
- }
- });
- };
- self.stopWalkAnimation = function () {
- self.walkAnimationActive = false;
- tween.stop(dinoGraphics, {
- y: true,
- rotation: true
- });
- tween(dinoGraphics, {
- y: 0,
- rotation: 0
- }, {
- duration: 200,
- easing: tween.easeOut
- });
- };
self.update = function () {
if (self.isJumping) {
self.jumpSpeed += self.gravity;
self.y += self.jumpSpeed;
@@ -172,16 +116,8 @@
self.isJumping = false;
self.jumpSpeed = 0;
}
}
- // Start walking animation when not jumping or ducking
- if (!self.isJumping && !self.isDucking && !self.walkAnimationActive) {
- self.startWalkAnimation();
- }
- // Stop walking animation when jumping or ducking
- if ((self.isJumping || self.isDucking) && self.walkAnimationActive) {
- self.stopWalkAnimation();
- }
};
return self;
});
var Obstacle = Container.expand(function (type) {
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