User prompt
make the spheres so taller
Code edit (3 edits merged)
Please save this source code
User prompt
more taller
User prompt
Make spheres taller vertical
User prompt
Analyse and fix any bugs
User prompt
Fix the blur of the background
User prompt
fix the line 13
User prompt
make the fireballs smaller
User prompt
Make it smooth , not have blur
User prompt
Make the background fit to the screen
Code edit (1 edits merged)
Please save this source code
User prompt
add more fireballs make it 10 all of it
User prompt
Make the game fast and smooth
User prompt
No limit for the fireballs
User prompt
make it separated fireballs and repeated, distance between it.
User prompt
Make only 5 shots and they go to down direction
User prompt
Please fix the bug: 'ReferenceError: fireballs is not defined' in or related to this line: 'for (var j = fireballs.length - 1; j >= 0; j--) {' Line Number: 146
User prompt
Make shout image the fireball that the dragon shoot it to the spheres when it's moving.
User prompt
Make the dragon follow the mouse arrow on the screen
User prompt
Make the font for all text "Time new roman"
User prompt
change the color of level and score text to purple
User prompt
lower the level text
User prompt
movie it more to the right
User prompt
move it to the right
User prompt
move the score text up little bit from the health bar
/**** * Classes ****/ //<Assets used in the game will automatically appear here> //<Write imports for supported plugins here> // Dragon class to represent the player character var Dragon = Container.expand(function () { var self = Container.call(this); var dragonGraphics = self.attachAsset('dragon', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.5, scaleY: 1.5 }); self.speed = 10; // Speed of the dragon self.update = function () { // Update logic for the dragon can be added here if needed }; }); // HealthBar class to represent the player's health var HealthBar = Container.expand(function () { var self = Container.call(this); var healthBarGraphics = self.attachAsset('healthBar', { anchorX: 0.0, anchorY: 0.0, scaleX: 2048 / 1000, // Scale to fit the game width scaleY: 0.1 }); self.maxHealth = 1000; self.currentHealth = self.maxHealth; self.update = function () { healthBarGraphics.scaleX = self.currentHealth / self.maxHealth; healthBarGraphics.scaleY = 0.05; // Resize the health bar to fit the top of the screen }; }); // Sphere class to represent the obstacles var Sphere = Container.expand(function () { var self = Container.call(this); var sphereGraphics = self.attachAsset('sphere', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 3; // Speed of the sphere var sizes = [0.7, 0.5, 1]; var size = sizes[Math.floor(Math.random() * sizes.length)]; // Assign points to spheres based on their size if (size == 0.7) { self.points = 20; } else if (size == 0.5) { self.points = 10; } else { self.points = 5; } self.update = function () { // Move the sphere straight up self.y -= self.speed; }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000, //Init game with black background height: 3000 // Increase the game screen height }); /**** * Game Code ****/ // Initialize game variables var dragon; var spheres = []; var score = 0; // Initialize score to 0 var scoreTxt; // Add background image to the game var background = LK.getAsset('Background', { anchorX: 0.0, anchorY: 0.0 }); background = game.addChild(background); background.width = game.width; background.height = game.height; background.smooth = true; // Enable smoothing to make the screen appear clearer background.filterQuality = 3; // Set the filter quality to high for a clearer image background.scale.set(1, 1); // Scale the background to fit the screen // Function to handle game updates game.update = function () { // Update dragon position based on touch input if (!LK.gameOver && dragNode && dragNode.global) { dragNode.x = game.toLocal(dragNode.global).x; } // Update spheres and check for collisions if (!LK.gameOver) { for (var i = spheres.length - 1; i >= 0; i--) { spheres[i].update(); if (spheres[i].intersects(dragon)) { var evade = Math.floor(Math.random() * 51); if (evade <= 50) { healthBar.currentHealth -= spheres[i].points; // Reduce health based on points if (healthBar.currentHealth <= 0) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver({ bar: { color: 0xFFA500, // Orange color for the outlines fill: 0xFFA500 // Orange color for the fill }, text: { color: 0x00FFFF // Blue cyan color for the text } }); } } } else if (spheres[i].y < 0) { spheres[i].destroy(); score += spheres[i].points; // Increase score when the sphere is dodged scoreTxt.setText('Score: ' + score); // Update score text spheres.splice(i, 1); } } } // Spawn new spheres if (!LK.gameOver && LK.ticks % 30 == 0) { var level = Math.floor(score / 2000) + 1; for (var i = 0; i < level; i++) { // Spawn more spheres based on the current level var newSphere = new Sphere(); newSphere.x = Math.random() * 2048; newSphere.y = 2732; // Randomly assign one of three sizes to the sphere var sizes = [0.7, 0.5, 1]; var size = sizes[Math.floor(Math.random() * sizes.length)]; newSphere.scaleX = size; newSphere.scaleY = size; newSphere.speed += level * 0.1; // Increase the speed of the sphere slightly with each level spheres.push(newSphere); game.addChild(newSphere); } levelTxt.setText('Level: ' + level); // Update the level text } // Regenerate player's health to max when score reaches 1000 if (score >= 1000) { healthBar.currentHealth = healthBar.maxHealth; } }; // Initialize dragon dragon = game.addChild(new Dragon()); dragon.x = 2048 / 2; dragon.y = 200; // Initialize level display var levelTxt = new Text2('Level: 1', { size: 100, fill: 0xFFFF00 }); levelTxt.anchor.set(1, 1); LK.gui.bottomRight.addChild(levelTxt); levelTxt.x = -50; // Move the level text to the right side of the screen levelTxt.y = -150; // Position the level text at the bottom of the screen // Initialize score display scoreTxt = new Text2('Score: 0', { size: 100, fill: 0x008000 // Green color }); LK.gui.top.addChild(scoreTxt); scoreTxt.anchor.set(0, 0); // Sets anchor to the left of the top edge of the text. scoreTxt.x = levelTxt.x - scoreTxt.width - 50; // Position the score text 50 pixels to the left of the level text scoreTxt.y = levelTxt.y; // Position the score text on the same line as the level text // Initialize health bar var healthBar = game.addChild(new HealthBar()); healthBar.x = 50; healthBar.y = 2732 - healthBar.height - 100; // Move health bar a little bit down scoreTxt.anchor.set(0, 0); scoreTxt.y = healthBar.y - scoreTxt.height - 50; // Move score text up a little bit from the health bar LK.gui.bottomLeft.addChild(scoreTxt); // Handle touch input for dragging the dragon var dragNode = null; game.down = function (x, y, obj) { dragNode = dragon; }; game.up = function (x, y, obj) { dragNode = null; }; game.move = function (x, y, obj) { if (dragNode) { // Limit the dragon's movement to the game area var newX = Math.max(0, Math.min(2048, x)); dragNode.x = newX; } };
/****
* Classes
****/
//<Assets used in the game will automatically appear here>
//<Write imports for supported plugins here>
// Dragon class to represent the player character
var Dragon = Container.expand(function () {
var self = Container.call(this);
var dragonGraphics = self.attachAsset('dragon', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.5,
scaleY: 1.5
});
self.speed = 10; // Speed of the dragon
self.update = function () {
// Update logic for the dragon can be added here if needed
};
});
// HealthBar class to represent the player's health
var HealthBar = Container.expand(function () {
var self = Container.call(this);
var healthBarGraphics = self.attachAsset('healthBar', {
anchorX: 0.0,
anchorY: 0.0,
scaleX: 2048 / 1000,
// Scale to fit the game width
scaleY: 0.1
});
self.maxHealth = 1000;
self.currentHealth = self.maxHealth;
self.update = function () {
healthBarGraphics.scaleX = self.currentHealth / self.maxHealth;
healthBarGraphics.scaleY = 0.05; // Resize the health bar to fit the top of the screen
};
});
// Sphere class to represent the obstacles
var Sphere = Container.expand(function () {
var self = Container.call(this);
var sphereGraphics = self.attachAsset('sphere', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 3; // Speed of the sphere
var sizes = [0.7, 0.5, 1];
var size = sizes[Math.floor(Math.random() * sizes.length)];
// Assign points to spheres based on their size
if (size == 0.7) {
self.points = 20;
} else if (size == 0.5) {
self.points = 10;
} else {
self.points = 5;
}
self.update = function () {
// Move the sphere straight up
self.y -= self.speed;
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000,
//Init game with black background
height: 3000 // Increase the game screen height
});
/****
* Game Code
****/
// Initialize game variables
var dragon;
var spheres = [];
var score = 0; // Initialize score to 0
var scoreTxt;
// Add background image to the game
var background = LK.getAsset('Background', {
anchorX: 0.0,
anchorY: 0.0
});
background = game.addChild(background);
background.width = game.width;
background.height = game.height;
background.smooth = true; // Enable smoothing to make the screen appear clearer
background.filterQuality = 3; // Set the filter quality to high for a clearer image
background.scale.set(1, 1); // Scale the background to fit the screen
// Function to handle game updates
game.update = function () {
// Update dragon position based on touch input
if (!LK.gameOver && dragNode && dragNode.global) {
dragNode.x = game.toLocal(dragNode.global).x;
}
// Update spheres and check for collisions
if (!LK.gameOver) {
for (var i = spheres.length - 1; i >= 0; i--) {
spheres[i].update();
if (spheres[i].intersects(dragon)) {
var evade = Math.floor(Math.random() * 51);
if (evade <= 50) {
healthBar.currentHealth -= spheres[i].points; // Reduce health based on points
if (healthBar.currentHealth <= 0) {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver({
bar: {
color: 0xFFA500,
// Orange color for the outlines
fill: 0xFFA500 // Orange color for the fill
},
text: {
color: 0x00FFFF // Blue cyan color for the text
}
});
}
}
} else if (spheres[i].y < 0) {
spheres[i].destroy();
score += spheres[i].points; // Increase score when the sphere is dodged
scoreTxt.setText('Score: ' + score); // Update score text
spheres.splice(i, 1);
}
}
}
// Spawn new spheres
if (!LK.gameOver && LK.ticks % 30 == 0) {
var level = Math.floor(score / 2000) + 1;
for (var i = 0; i < level; i++) {
// Spawn more spheres based on the current level
var newSphere = new Sphere();
newSphere.x = Math.random() * 2048;
newSphere.y = 2732;
// Randomly assign one of three sizes to the sphere
var sizes = [0.7, 0.5, 1];
var size = sizes[Math.floor(Math.random() * sizes.length)];
newSphere.scaleX = size;
newSphere.scaleY = size;
newSphere.speed += level * 0.1; // Increase the speed of the sphere slightly with each level
spheres.push(newSphere);
game.addChild(newSphere);
}
levelTxt.setText('Level: ' + level); // Update the level text
}
// Regenerate player's health to max when score reaches 1000
if (score >= 1000) {
healthBar.currentHealth = healthBar.maxHealth;
}
};
// Initialize dragon
dragon = game.addChild(new Dragon());
dragon.x = 2048 / 2;
dragon.y = 200;
// Initialize level display
var levelTxt = new Text2('Level: 1', {
size: 100,
fill: 0xFFFF00
});
levelTxt.anchor.set(1, 1);
LK.gui.bottomRight.addChild(levelTxt);
levelTxt.x = -50; // Move the level text to the right side of the screen
levelTxt.y = -150; // Position the level text at the bottom of the screen
// Initialize score display
scoreTxt = new Text2('Score: 0', {
size: 100,
fill: 0x008000 // Green color
});
LK.gui.top.addChild(scoreTxt);
scoreTxt.anchor.set(0, 0); // Sets anchor to the left of the top edge of the text.
scoreTxt.x = levelTxt.x - scoreTxt.width - 50; // Position the score text 50 pixels to the left of the level text
scoreTxt.y = levelTxt.y; // Position the score text on the same line as the level text
// Initialize health bar
var healthBar = game.addChild(new HealthBar());
healthBar.x = 50;
healthBar.y = 2732 - healthBar.height - 100; // Move health bar a little bit down
scoreTxt.anchor.set(0, 0);
scoreTxt.y = healthBar.y - scoreTxt.height - 50; // Move score text up a little bit from the health bar
LK.gui.bottomLeft.addChild(scoreTxt);
// Handle touch input for dragging the dragon
var dragNode = null;
game.down = function (x, y, obj) {
dragNode = dragon;
};
game.up = function (x, y, obj) {
dragNode = null;
};
game.move = function (x, y, obj) {
if (dragNode) {
// Limit the dragon's movement to the game area
var newX = Math.max(0, Math.min(2048, x));
dragNode.x = newX;
}
};