User prompt
Build the poles faster
User prompt
the distance between posts should be 2 pixels
User prompt
the distance between cubes should be 2 pixels
User prompt
the distance between cubes and pillars should be 2 pixels
User prompt
the distance between cubes should be 2 pixels
User prompt
the flow of poles must be continuous
User prompt
columns should come out of the screen border already formed
User prompt
columns should come out of the screen border already formed and without gaps
User prompt
columns should come out of the screen border already formed and without gaps of more than 2 pixels
User prompt
columns should come out of the screen border already formed
User prompt
Fix Bug: 'TypeError: poles[0].getGlobalPosition is not a function' in or related to this line: 'while (poles.length > 0 && poles[0].getGlobalPosition().x + poles[0].width / 2 < 0) {' Line Number: 90
User prompt
Fix Bug: 'TypeError: poles[0].getGlobalPosition is not a function' in or related to this line: 'while (poles.length > 0 && poles[0].getGlobalPosition().x + poles[0].width / 2 < 0) {' Line Number: 90
User prompt
to make the flow of poles continuous
User prompt
the columns should come out of the screen boundary already formed
User prompt
make the distance between the poles 2 pixels
User prompt
the poles must stand close together
User prompt
the poles must be close to each other
User prompt
there must be no gaps between the posts
User prompt
fill the entire space with cubes
Initial prompt
Platformer
===================================================================
--- original.js
+++ change.js
@@ -9,9 +9,9 @@
var cube = self.attachAsset('cube', {
anchorX: 0.5,
anchorY: 0.5
});
- cube.y = -(self.cubes.length * 100);
+ cube.y = -(self.cubes.length * 100) - self.cubes.length * 2;
self.cubes.push(cube);
};
self.getHeight = function () {
return self.cubes.length * 100;
@@ -47,10 +47,10 @@
/****
* Game Code
****/
-// Initialize important asset arrays
// Initialize assets used in the game.
+// Initialize important asset arrays
var poles = [];
var hero;
// Create the hero
hero = game.addChild(new Hero());
@@ -59,9 +59,9 @@
// Create initial poles
function createInitialPoles() {
for (var i = 0; i < 5; i++) {
var pole = game.addChild(new Pole());
- pole.x = 2048 + i * 102; // Space out poles horizontally with 2 pixels between each pole, starting from the right edge of the screen
+ pole.x = 300 + i * 500; // Space out poles horizontally
pole.y = 2732; // Align base of pole with bottom of the screen
for (var j = 0; j < 3; j++) {
// Add 3 cubes to each pole
pole.addCube();
@@ -86,17 +86,13 @@
hero.velocityY = 0;
}
}
// Remove off-screen poles and create new ones
- while (poles.length > 0 && poles[0].x + poles[0].width / 2 < 0) {
+ if (poles.length > 0 && poles[0].x + poles[0].width / 2 < 0) {
poles[0].destroy();
poles.shift();
- }
- // Ensure there are always 5 poles on the screen
- while (poles.length < 5) {
- var lastPoleX = poles.length > 0 ? poles[poles.length - 1].x : 2048;
var newPole = game.addChild(new Pole());
- newPole.x = lastPoleX + 102; // Position new pole to the right of the last pole with 2 pixels gap
+ newPole.x = poles[poles.length - 1].x + 500; // Position new pole to the right of the last one
newPole.y = 2732;
var cubesCount = Math.floor(Math.random() * 3) + 1; // Random number of cubes between 1 and 3
for (var j = 0; j < cubesCount; j++) {
newPole.addCube();
girl sitting on Wrecking Ball, cartoon style.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
construction cranes on the sides of the frame, depth of field blur, cartoon style, black and white. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
"ALARM" text bubble, comic style. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
the surface is gray, concrete with a black square in the center. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Wrecking Ball with eyes, cartoon style.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
the surface is red, concrete with a black square in the center.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
"ALARM" text bubble yellow, comic book style.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
the surface is yellow, concrete with a black square in the center. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.