User prompt
Make different shapes of stone asset in level 4
User prompt
resize the objects of level 4 and make it small
User prompt
Make stone asset the objects that respawns in level 4 only, have same system of damage and points for score like other levels,
User prompt
Make stonelands asset for level 4, make the background 800x800, fit to screen, smooth,optimise the game.
User prompt
Remove any shaking in any backgrounds
User prompt
Analyse for bugs
User prompt
Set the asset lava_lands the background for level 2 only
User prompt
revert it to 800x800
User prompt
Fix the problem of the background lava_lands not appearing after reaching level 2 and score reach 200!
User prompt
Make all the backgrounds full resolution 3000x3000, optimise the game.
User prompt
Fix the background of level 2
User prompt
Revers last update to 1000x1000
User prompt
Make all the backgrounds resolution 1500x1500 and fit it to the creen
User prompt
Make all backgrounds fit to screen
User prompt
Make resolution for the assets of the background 2000*2000
Code edit (1 edits merged)
Please save this source code
User prompt
Fix pixels on the backgrounds
User prompt
Make the backgrounds fit to screen, and clearer every time game start
User prompt
Rename lava_planets to Lava_lands
User prompt
Fix problem of the changing background from background "Green_lands" to background "Lava_planet"
User prompt
Make the images clear for all levels
User prompt
Ensure that the backgrounds changing by level
User prompt
Make shout2 for level 2 and shout3 for level 3
User prompt
Get damage by all objects with same amount in level 1
User prompt
add more objects of level 2 and level 3 Make rondom size 3 sizes
/**** * 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, smooth: true, filterQuality: 2 }); self.speed = 15; // Increase the speed of the dragon self.update = function () { // Update logic for the dragon to flip based on movement direction if (self.x < 2048 / 2) { dragonGraphics.scaleX = -1; // Flip horizontally when on the left side of the screen } else { dragonGraphics.scaleX = 1; // Normal orientation when on the right side of the screen } // Removed unnecessary variable to optimize performance }; }); // Fireball class to represent the fireballs that the dragon shoots var Fireball = Container.expand(function () { var self = Container.call(this); var fireballGraphics = self.attachAsset('Shout', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.0, scaleY: 1.0, smooth: true, filterQuality: 1 }); self.speed = 30; // Further increase the speed of the fireball self.update = function () { // Move the fireball straight down self.y += self.speed; }; }); // Fireball2 class to represent the fireballs that the dragon shoots in level 2 var Fireball2 = Container.expand(function () { var self = Container.call(this); var fireballGraphics = self.attachAsset('Shout2', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.0, scaleY: 1.0, smooth: true, filterQuality: 1 }); self.speed = 30; // Speed of the fireball self.update = function () { // Move the fireball straight down self.y += self.speed; }; }); // Fireball3 class to represent the fireballs that the dragon shoots in level 3 var Fireball3 = Container.expand(function () { var self = Container.call(this); var fireballGraphics = self.attachAsset('Shout3', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.0, scaleY: 1.0, smooth: true, filterQuality: 1 }); self.speed = 30; // Speed of the fireball self.update = function () { // Move the fireball straight down self.y += self.speed; }; }); // 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: 2530 / 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 }; }); var Icerocks = Container.expand(function () { var self = Container.call(this); var icerocksGraphics = self.attachAsset('Icerocks', { anchorX: 0.5, anchorY: 0.5, scaleX: level === 3 ? 1.5 : 1.0, scaleY: level === 3 ? 1.5 : 1.0, smooth: true, filterQuality: 1 }); self.speed = level === 3 ? 10 : 5; // Increase speed for level 3 self.update = function () { // Move the icerocks upwards self.y -= self.speed; }; }); var Lavarocks = Container.expand(function () { var self = Container.call(this); var lavarocksGraphics = self.attachAsset('Lavarocks', { anchorX: 0.5, anchorY: 0.5, scaleX: level === 2 ? 1.5 : 1.0, scaleY: level === 2 ? 1.5 : 1.0, smooth: true, filterQuality: 1 }); self.speed = level === 2 ? 10 : 5; // Increase speed for level 2 self.update = function () { // Move the lavarocks upwards self.y -= self.speed; }; }); var Lavarocks1 = Container.expand(function () { var self = Container.call(this); var lavarocks1Graphics = self.attachAsset('Lavarocks1', { anchorX: 0.5, anchorY: 0.5, scaleX: level === 2 ? 1.5 : 1.0, scaleY: level === 2 ? 1.5 : 1.0, smooth: true, filterQuality: 1 }); self.speed = level === 2 ? 10 : 5; // Increase speed for level 2 self.update = function () { // Move the lavarocks1 upwards self.y -= self.speed; }; }); var Lavarocks2 = Container.expand(function () { var self = Container.call(this); var lavarocks2Graphics = self.attachAsset('Lavarocks2', { anchorX: 0.5, anchorY: 0.5, scaleX: level === 2 ? 1.5 : 1.0, scaleY: level === 2 ? 1.5 : 1.0, smooth: true, filterQuality: 1 }); self.speed = level === 2 ? 10 : 5; // Increase speed for level 2 self.update = function () { // Move the lavarocks2 upwards self.y -= self.speed; }; }); var Tree = Container.expand(function () { var self = Container.call(this); var treeGraphics = self.attachAsset('Tree01', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.8, scaleY: 0.8, smooth: true, filterQuality: 1 }); self.speed = 10; // Further increase the speed of the tree self.update = function () { // Move the tree 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 fireballs = []; // Initialize fireballs array var score = 0; // Initialize score to 0 var scoreTxt; var level = 1; // Initialize level to 1 // Add background image to the game for level 1 var backgroundLevel1 = LK.getAsset('Green_lands', { anchorX: 0.0, anchorY: 0.0 }); backgroundLevel1.smooth = true; // Enable smoothing to remove pixelation backgroundLevel1.filterQuality = 20; // Further increase the filter quality for better clarity backgroundLevel1.scale.set(2048 / backgroundLevel1.width, 2732 / backgroundLevel1.height); // Scale the background to fit the screen backgroundLevel1.visible = true; // Initially visible game.addChild(backgroundLevel1); // Add background image for level 2 var backgroundLevel2 = LK.getAsset('lava_planet', { anchorX: 0.0, anchorY: 0.0 }); backgroundLevel2.smooth = true; backgroundLevel2.filterQuality = 20; // Further increase the filter quality for better clarity backgroundLevel2.scale.set(2048 / backgroundLevel2.width, 2732 / backgroundLevel2.height); backgroundLevel2.visible = false; // Initially hidden game.addChild(backgroundLevel2); // Add background image for level 3 var backgroundLevel3 = LK.getAsset('Ice_lands', { anchorX: 0.0, anchorY: 0.0 }); backgroundLevel3.smooth = true; backgroundLevel3.filterQuality = 20; // Further increase the filter quality for better clarity backgroundLevel3.scale.set(2048 / backgroundLevel3.width, 2732 / backgroundLevel3.height); backgroundLevel3.visible = false; // Initially hidden game.addChild(backgroundLevel3); // Refresh the background to be clearer & fit to screen every 60 ticks game.update = function () { background.x = 2048 / 2 + Math.sin(LK.ticks * 0.2) * 20; // Increase shake intensity left and right around the center background.y = 2732 / 2 + Math.sin(LK.ticks * 0.2) * 20; // Increase shake intensity up and down around the center if (background.y >= 2732) { background.y = -2732; } }; // 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; } // Reuse off-screen trees or spawn new ones if necessary if (level === 1 && !LK.gameOver && LK.ticks % 50 == 0) { // Further reduce the interval for spawning trees to add more tree objects // Reduce the interval for spawning trees var newTree; for (var i = 0; i < spheres.length; i++) { if (spheres[i] instanceof Tree && spheres[i].y < -200) { // Check if the tree is off-screen newTree = spheres[i]; break; } } if (!newTree) { newTree = new Tree(); spheres.push(newTree); game.addChild(newTree); } newTree.x = Math.random() * (2048 - newTree.width) + newTree.width / 2; newTree.y = 2732; } // Check for collisions between fireballs and trees or Lavarocks for (var i = fireballs.length - 1; i >= 0; i--) { if (fireballs[i].y > 2732) { fireballs[i].destroy(); fireballs.splice(i, 1); continue; } for (var j = spheres.length - 1; j >= 0; j--) { if (fireballs[i].intersects(spheres[j])) { // Add random points from 0-40 when the dragon shoots the trees or Lavarocks var points = Math.floor(Math.random() * 41); score += points; // Remove the fireball and the object from the game fireballs[i].destroy(); fireballs.splice(i, 1); spheres[j].destroy(); spheres.splice(j, 1); break; } } } // Check for collisions between dragon and rocks for (var j = spheres.length - 1; j >= 0; j--) { if (dragon.intersects(spheres[j])) { // Decrease the dragon's health healthBar.currentHealth -= 20; // Consistent damage taken by the dragon from all objects in level 1 // Remove the rock from the game spheres[j].destroy(); spheres.splice(j, 1); break; } // Remove off-screen trees if (spheres[j].y < -200) { spheres[j].destroy(); spheres.splice(j, 1); } // Reuse off-screen lavarocks or spawn new ones if necessary if (score >= 200 && level === 1) { level = 2; levelTxt.setText('Level: 2'); var newLavarocks = new Lavarocks(); spheres.push(newLavarocks); game.addChild(newLavarocks); newLavarocks.x = Math.random() * (2048 - newLavarocks.width) + newLavarocks.width / 2; newLavarocks.y = -100; } } // Update the score display when the dragon gets points scoreTxt.setText('Score: ' + score); // Regenerate player's health to max when score reaches 1000 if (score >= 1000) { healthBar.currentHealth = healthBar.maxHealth; } // Transition to level 2 when score reaches 200 if (score >= 200 && level === 1) { level = 2; levelTxt.setText('Level: 2'); backgroundLevel1.visible = false; // Hide level 1 background backgroundLevel2.visible = true; // Show level 2 background backgroundLevel2.x = 0; // Reset position for level 2 background backgroundLevel2.y = 0; // Reset position for level 2 background var newLavarocks = new Lavarocks(); spheres.push(newLavarocks); game.addChild(newLavarocks); newLavarocks.x = Math.random() * (2048 - newLavarocks.width) + newLavarocks.width / 2; newLavarocks.y = -100; // Ensure the background is refreshed to fit the screen backgroundLevel2.scale.set(2048 / backgroundLevel2.width, 2732 / backgroundLevel2.height); } // Transition to level 3 when score reaches 421 if (score >= 421 && level === 2) { level = 3; levelTxt.setText('Level: 3'); backgroundLevel2.visible = false; // Hide level 2 background backgroundLevel3.visible = true; // Show level 3 background backgroundLevel3.x = 0; // Reset position for level 3 background backgroundLevel3.y = 0; // Reset position for level 3 background } // Respawn Lavarocks, Lavarocks1, and Lavarocks2 randomly in level 2 if (level === 2 && !LK.gameOver && LK.ticks % 50 == 0) { var newLavarock; for (var i = 0; i < spheres.length; i++) { if ((spheres[i] instanceof Lavarocks || spheres[i] instanceof Lavarocks1 || spheres[i] instanceof Lavarocks2) && spheres[i].y < -200) { newLavarock = spheres[i]; break; } } if (!newLavarock) { var randomType = Math.floor(Math.random() * 3); if (randomType === 0) { newLavarock = new Lavarocks(); } else if (randomType === 1) { newLavarock = new Lavarocks1(); } else { newLavarock = new Lavarocks2(); } spheres.push(newLavarock); game.addChild(newLavarock); } newLavarock.x = Math.random() * (2048 - newLavarock.width) + newLavarock.width / 2; newLavarock.y = 2732; var randomScale = 0.5 + Math.random() * 1.5; // Random scale between 0.5 and 2.0 newLavarock.scaleX = randomScale; newLavarock.scaleY = randomScale; } // Respawn Icerocks randomly in level 3 if (level === 3 && !LK.gameOver && LK.ticks % 50 == 0) { var newIcerock; for (var i = 0; i < spheres.length; i++) { if (spheres[i] instanceof Icerocks && spheres[i].y < -200) { newIcerock = spheres[i]; break; } } if (!newIcerock) { newIcerock = new Icerocks(); spheres.push(newIcerock); game.addChild(newIcerock); } newIcerock.x = Math.random() * (2048 - newIcerock.width) + newIcerock.width / 2; newIcerock.y = 2732; var randomScale = 0.5 + Math.random() * 1.5; // Random scale between 0.5 and 2.0 newIcerock.scaleX = randomScale; newIcerock.scaleY = randomScale; } }; // 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: 0x800080, // Purple color font: "'Time new roman',Impact,'Arial Black',Tahoma" }); 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 = -50; // Position the level text at the bottom of the screen // Initialize score display scoreTxt = new Text2('Score: 0', { size: 100, fill: 0x800080, // Purple color font: "'Time new roman',Impact,'Arial Black',Tahoma" }); LK.gui.top.addChild(scoreTxt); scoreTxt.anchor.set(0, 0); // Sets anchor to the left of the top edge of the text. scoreTxt.x = 50; // Position the score text a little bit to the right scoreTxt.y = levelTxt.y - scoreTxt.height - 100; // Position the score text 100 pixels above the level text // Initialize health bar var healthBar = game.addChild(new HealthBar()); healthBar.x = 2000 / 2 - healthBar.width / 2 + 100; // Move health bar to the right a little bit healthBar.y = 2710 - healthBar.height / 2; // Move health bar to the middle of the bottom side scoreTxt.anchor.set(0, 1); LK.gui.bottomLeft.addChild(scoreTxt); scoreTxt.x = 50; // Position the score text a little bit to the right scoreTxt.y = -50; // Position the score text above the health bar // 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(dragon.width / 2, Math.min(2048 - dragon.width / 2, x)); var newY = Math.max(dragon.height / 2, Math.min(2732 - dragon.height / 2, y)); dragNode.x = newX; dragNode.y = newY; // Shoot a fireball at regular intervals if (LK.ticks % 10 == 0) { // Reduce the interval for shooting fireballs for (var i = 0; i < 1; i++) { var fireball; if (level === 2) { fireball = new Fireball2(); } else if (level === 3) { fireball = new Fireball3(); } else { fireball = new Fireball(); } fireball.x = dragon.x; fireball.y = dragon.y; fireballs.push(fireball); game.addChild(fireball); } } } };
===================================================================
--- original.js
+++ change.js
@@ -322,8 +322,10 @@
spheres.push(newLavarocks);
game.addChild(newLavarocks);
newLavarocks.x = Math.random() * (2048 - newLavarocks.width) + newLavarocks.width / 2;
newLavarocks.y = -100;
+ // Ensure the background is refreshed to fit the screen
+ backgroundLevel2.scale.set(2048 / backgroundLevel2.width, 2732 / backgroundLevel2.height);
}
// Transition to level 3 when score reaches 421
if (score >= 421 && level === 2) {
level = 3;