User prompt
background should be visible on screen from the start and then 30 seconds later it should be nightbackground and then 30 seconds after that alternate between both
User prompt
alternate the visibility of night and day backgrounds every 30 seconds
User prompt
✅ Change initial visibility of day and night backgrounds
User prompt
do the opposite, i want to see the other background initially on the screen
User prompt
✅ Change the initial visibility of the day-time background to false ✅ Change the initial visibility of the night-time background to false
User prompt
✅ Change the initial visibility of the day-time background to true ✅ Change the initial visibility of the night-time background to false
User prompt
make sure the first background visible on start of the game is night background
User prompt
make sure the first background visible on start of the game is day background
User prompt
make sure the first background visible on start of the game is night background
User prompt
make sure the first background visible on start of the game is day background
User prompt
background should be visible on screen from the start and then 30 seconds later it should be nightbackground and then 30 seconds after that alternate between both
User prompt
only one background can be visible on the screen at a time
User prompt
every 30 seconds, alternate the visibility on screen between background and nighttime background
User prompt
i want to add a night-time background to the playspace let me imagine one, create the asset
User prompt
every 10 seconds, accelerate the speed of cactus and also the speed of the pterodactyl by 10%
User prompt
accelerate the speed of cactus and pterodactyl by 10% everytime the score reaches increments of 10
User prompt
scale the dinosaur by 5% and -5% every 0.3 second
User prompt
scale the dinosaur by 5% and -5% every 0.5 seconds
User prompt
scale the dinosaur by 5% and -5% every second
Code edit (1 edits merged)
Please save this source code
User prompt
move cloud in the middle of the screen
User prompt
move cloud to the left
User prompt
move cloud to the left
User prompt
move the cloud under the title screen
Code edit (2 edits merged)
Please save this source code
/****
* Classes
****/
var Background = Container.expand(function () {
var self = Container.call(this);
self.attachAsset('background', {
width: 2048,
height: 2732,
anchorX: 0,
anchorY: 0
});
self.move = function () {
self.x -= game.speed;
if (self.x <= -2048) {
self.x = 0;
}
};
});
var Cactus = Container.expand(function () {
var self = Container.call(this);
var cactusGraphics = self.attachAsset('cactus', {
anchorX: 0.5,
anchorY: 1.0
});
self.move = function () {
self.x -= game.speed * 2;
if (LK.ticks % 60 == 0) {
self.scale.x *= -1;
}
};
});
var Cloud = Container.expand(function () {
var self = Container.call(this);
self.attachAsset('cloud', {
anchorX: 0.55,
anchorY: 0.5
});
self.move = function () {
self.x -= game.speed / 2;
};
});
var Dinosaur = Container.expand(function () {
var self = Container.call(this);
var dinosaurGraphics = self.attachAsset('dinosaur', {
anchorX: 0.5,
anchorY: 1.0
});
self.isJumping = false;
self.jumpSpeed = 0;
self.gravity = 0.5;
self.jump = function () {
if (!self.isJumping && self.y >= game.floorLevel) {
self.isJumping = true;
self.jumpSpeed = -25;
}
};
self.update = function () {
if (self.isJumping) {
self.y += self.jumpSpeed;
self.jumpSpeed += self.gravity;
}
if (self.y > game.floorLevel) {
self.y = game.floorLevel;
self.isJumping = false;
}
};
});
var Ground = Container.expand(function () {
var self = Container.call(this);
self.attachAsset('ground', {
anchorX: 0,
anchorY: 1.0
});
self.move = function () {
self.x -= game.speed;
if (self.x <= -2048) {
self.x = 0;
}
};
});
var Pterodactyl = Container.expand(function () {
var self = Container.call(this);
var pterodactylGraphics = self.attachAsset('pterodactyl', {
anchorX: 0.5,
anchorY: 0.5
});
self.move = function () {
self.x -= game.speed * 2;
self.y += Math.sin(LK.ticks / 10) * 5;
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87ceeb
});
/****
* Game Code
****/
var title = LK.gui.top.addChild(LK.getAsset('title', {
anchorX: 0,
anchorY: 0,
x: -500,
y: 0
}));
var background1 = game.addChild(new Background());
var scoreTxt = new Text2(LK.getScore().toString(), {
size: 150,
fill: '#ffffff'
});
scoreTxt.anchor.set(0.5, 0.5);
LK.gui.center.addChild(scoreTxt);
var ground1 = game.addChild(new Ground());
var ground2 = game.addChild(new Ground());
ground2.x = 2048;
game.speed = 5;
game.floorLevel = 2732 - 200; // Dinosaur stands on the floor
game.score = 0;
game.obstacles = [];
var dinosaur = game.addChild(new Dinosaur());
dinosaur.x = 300;
dinosaur.y = game.floorLevel;
game.on('down', function () {
dinosaur.jump();
});
LK.on('tick', function () {
dinosaur.update();
if (LK.ticks % 60 == 0) {
game.score += 1;
}
scoreTxt.setText(LK.getScore().toString());
LK.setScore(Math.floor(game.score)); // Update the score display
// Move the ground and background
ground1.move();
ground1.move();
ground2.move();
// Handle obstacles
if (LK.ticks % 120 == 0) {
// Add a new obstacle every 2 seconds
var obstacle;
if (Math.random() < 0.5) {
obstacle = new Cactus();
obstacle.y = game.floorLevel;
} else {
obstacle = new Pterodactyl();
obstacle.y = game.floorLevel - Math.random() * 300 - 300; // Random height for pterodactyl
}
obstacle.x = 2048;
game.obstacles.push(obstacle);
game.addChild(obstacle);
}
if (LK.ticks % 600 == 0) {
// Add a new cloud every 10 seconds
var cloud = new Cloud();
cloud.y = Math.random() * 1000; // Random height for cloud
cloud.x = 2048;
game.addChild(cloud);
}
for (var i = game.obstacles.length - 1; i >= 0; i--) {
game.obstacles[i].move();
if (dinosaur.intersects(game.obstacles[i])) {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
if (game.obstacles[i].x < -100) {
// Remove off-screen obstacles
game.obstacles[i].destroy();
game.obstacles.splice(i, 1);
}
}
});
pixel art pterodactyl flying. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art cactus. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art desert ground sand. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art desert. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art clouds. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art night-time desert. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a microchip no shadows. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a title screen logo with "GPT DASH" written on it, no shadows. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a chat gpt robot running with gpt engraved on his chest and a smiley face on his robot visor. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art tiling of a desert sandy ground.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art particles. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.