Code edit (4 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: particlesArray is not defined' in or related to this line: 'particlesArray.push(star);' Line Number: 311
Code edit (5 edits merged)
Please save this source code
User prompt
make an explosions of small stars when player hits the collectible
Code edit (10 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: floor is not defined' in or related to this line: 'floor.move();' Line Number: 250
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Remix started
Copy GPT Dash!
===================================================================
--- original.js
+++ change.js
@@ -86,9 +86,11 @@
}
if (LK.ticks % 18 == 0) {
self.scale.x *= self.scale.x > 1 ? 0.95 : 1.05;
self.scale.y *= self.scale.y > 1 ? 0.95 : 1.05;
+ //self.y += self.y > game.floorLevel ? 30 : -30;
}
+ self.y += 100 * Math.sin(LK.ticks % 100);
};
});
var Floor = Container.expand(function () {
var self = Container.call(this);
@@ -135,22 +137,24 @@
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.direction = Math.random() < 0.5 ? 1 : -1;
self.move = function () {
if (LK.ticks % 600 == 0) {
game.speed *= 1.1;
}
self.x -= game.speed * 2;
- self.y += Math.sin(LK.ticks / 10) * 5;
+ //self.y += Math.sin(LK.ticks / 10) * 5;
+ self.rotation += Math.PI * 0.01 * self.direction;
};
});
/****
@@ -172,15 +176,16 @@
game.setChildIndex(floor, game.children.length - 1);
var title = LK.gui.top.addChild(LK.getAsset('title', {
anchorX: 0,
anchorY: 0,
- x: -500,
- y: 0
+ x: -250,
+ //-500,
+ y: 100
}));
-var background1 = game.addChildAt(new Background(), 0);
+//var background1 = game.addChildAt(new Background(), 0);
var nightBackground1 = game.addChildAt(new NightBackground(), 0);
-nightBackground1.visible = false;
-game.setChildIndex(background1, 0);
+//nightBackground1.visible = false;
+//game.setChildIndex(background1, 0);
game.setChildIndex(nightBackground1, 0);
var scoreTxt = new Text2(LK.getScore().toString(), {
size: 150,
fill: '#ffffff'
@@ -202,16 +207,18 @@
game.on('down', function () {
dinosaur.jump();
});
LK.on('tick', function () {
+ /*
if (LK.ticks % 2700 == 0) {
background1.visible = !background1.visible;
nightBackground1.visible = !nightBackground1.visible;
}
if (LK.ticks % 2700 == 1350) {
background1.visible = !background1.visible;
nightBackground1.visible = !nightBackground1.visible;
}
+ */
dinosaur.update();
if (LK.ticks % 60 == 0) {
game.score += 1;
}
@@ -258,30 +265,8 @@
// Destroy the collectible and add +10 to the score when dinosaur collides with it
game.collectibles[i].destroy();
game.collectibles = [];
game.score += 10;
- // Randomly select one of the six messages
- var messages = ["Gathering data like a pro!", "Dodging glitches, snatching data!", "Swifter than a byte, slicker than code!", "My endless run never stops!", "I'm the endless runner of information!", "I make data collection look easy!"];
- var message = messages[Math.floor(Math.random() * messages.length)];
- // Show the message at the bottom center of the screen for 3 seconds before fading out
- var messageTxt = new Text2(message, {
- size: 70,
- fill: '#000000',
- // Darker color
- font: 'bold' // Bold text
- });
- messageTxt.anchor.set(0.5, 1);
- LK.gui.bottom.addChild(messageTxt);
- // Fade out the message after 3 seconds
- LK.setTimeout(function () {
- var fadeOutInterval = LK.setInterval(function () {
- messageTxt.alpha -= 0.02;
- if (messageTxt.alpha <= 0) {
- LK.clearInterval(fadeOutInterval);
- messageTxt.destroy();
- }
- }, 50);
- }, 3000);
}
if (game.collectibles[i] && game.collectibles[i].x < -100) {
// Remove off-screen collectibles
game.collectibles[i].destroy();