User prompt
Double the speed of targets, let targets have the same speed.
User prompt
Remove hero, we dont need it
User prompt
Fix Bug: 'ReferenceError: hero is not defined' in this line: 'hero.x = pos.x;' Line Number: 55
User prompt
Remove all existing objects. Make 5 dots on random positions (call them 'Targets') Let dots go in random directions, but only vertically or horizontally When Target leaves the scene, make it appear on the opposite side of the scene.
User prompt
make 5 dots on random positions
User prompt
Remove all
User prompt
When touches left =0, and still there's at least one target on the screen, the game is over.
User prompt
When number of touches = 0, if not all targets are destroyed, the game is over
User prompt
When the player touches 'Next' button, just increase the level number, reset the number of touches to 5 and create new targets on the screen. Make this numberr or targets: level number * 5
User prompt
Fix Bug: 'ReferenceError: touchesLeftText is not defined' in this line: 'if (touchesLeftText) touchesLeftText.destroy();' Line Number: 63
User prompt
Fix Bug: 'ReferenceError: levelText is not defined' in this line: 'if (levelText) levelText.destroy();' Line Number: 55
User prompt
When the level is over, and the user clicks the 'Next' button, destroy all text fields and re-create them.
User prompt
Fix Bug: 'ReferenceError: touchesLeftText is not defined' in this line: 'touchesLeftText.setText('Touches left: ' + ammunition);' Line Number: 62
User prompt
Fix Bug: 'ReferenceError: touchesLeftText is not defined' in this line: 'touchesLeftText.setText('Touches left: ' + ammunition);' Line Number: 62
User prompt
There's a duplicate of text field 'Touches left'. Fix it.
User prompt
Fix Bug: 'ReferenceError: touchesLeftText is not defined' in this line: 'touchesLeftText.setText('Touches left: ' + ammunition);' Line Number: 62
User prompt
Fix Bug: 'ReferenceError: touchesLeftText is not defined' in this line: 'touchesLeftText.setText('Touches left: ' + ammunition);' Line Number: 62
User prompt
Fix Bug: 'ReferenceError: touchesLeftText is not defined' in this line: 'touchesLeftText.setText('Touches left: ' + ammunition);' Line Number: 62
User prompt
Fix Bug: 'ReferenceError: levelText is not defined' in this line: 'levelText.setText('Lvl: ' + self.level);' Line Number: 55
User prompt
Fix Bug: 'ReferenceError: levelText is not defined' in this line: 'levelText.setText('Lvl: ' + self.level);' Line Number: 55
User prompt
When user taps the 'Next level' button, start the next level. Create more targets (number of targets should be = level * 5. Reset number or allowed touches to 5.
User prompt
Fix Bug: 'ReferenceError: levelText is not defined' in this line: 'levelText.setText('Lvl: ' + self.level);' Line Number: 55
User prompt
Make the 'Next' level buton 3 times wider. Place a label on it: "Next"
User prompt
Center the instruction text horizontally.
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'setText')' in this line: 'self.levelText.setText('Lvl: ' + self.level);' Line Number: 48
var Projectile = Container.expand(function (direction) { var self = Container.call(this); var projectileGraphics = self.createAsset('projectile', 'Projectile Graphics', .25, .25); self.speed = 16; self.direction = direction; self.move = function () { switch (self.direction) { case 'up': self.y -= self.speed; break; case 'down': self.y += self.speed; break; case 'left': self.x -= self.speed; break; case 'right': self.x += self.speed; break; } if (self.x < -self.width || self.x > 2048 || self.y < -self.height || self.y > 2732) { self.destroy(); } }; }); var Target = Container.expand(function () { var self = Container.call(this); var dotGraphics = self.createAsset('dot', 'Dot Graphics', .5, .5); self.direction = Math.random() < 0.5 ? 'horizontal' : 'vertical'; self.speed = 4; self.move = function () { if (self.direction === 'horizontal') { self.x += self.speed; if (self.x > 2048) self.x = -self.width; else if (self.x < -self.width) self.x = 2048; } else { self.y += self.speed; if (self.y > 2732) self.y = -self.height; else if (self.y < -self.height) self.y = 2732; } }; }); var NextLevelButton = Container.expand(function () { var self = Container.call(this); var nextButtonGraphics = self.createAsset('nextButton', 'Next Level', .5, .5); nextButtonGraphics.scale.x = 3; var nextLabel = new Text2('Next', { size: 50, fill: '#ffffff' }); nextLabel.anchor.set(0.5, 0.5); self.addChild(nextLabel); self.x = 2048 / 2; self.y = 2732 / 2 + 100; self.on('down', function () { self.level++; ammunition = 5; for (var i = 0; i < self.level * 5; i++) { var target = new Target(); target.x = Math.random() * 2048; target.y = Math.random() * 2732; dots.push(target); self.addChild(target); } self.destroy(); }); }); var Game = Container.expand(function () { var self = Container.call(this); LK.stageContainer.setBackgroundColor(0x008080); LK.on('tick', function () { for (var i = 0; i < dots.length; i++) { dots[i].move(); } for (var j = 0; j < projectiles.length; j++) { projectiles[j].move(); for (var i = 0; i < dots.length; i++) { if (projectiles[j].intersects(dots[i])) { var directions = ['up', 'down', 'left', 'right']; directions.forEach(function (direction) { var newProjectile = new Projectile(direction); newProjectile.x = dots[i].x; newProjectile.y = dots[i].y; projectiles.push(newProjectile); self.addChild(newProjectile); }); dots[i].destroy(); dots.splice(i, 1); projectiles[j].destroy(); projectiles.splice(j, 1); targetsLeftText.setText('Targets left: ' + dots.length); if (dots.length === 0 && !levelCompleted) { levelCompleted = true; var levelCompletedText = new Text2('Level ' + level + ' completed!', { size: 100, fill: '#ffffff' }); levelCompletedText.anchor.set(0.5, 0.5); levelCompletedText.x = 2048 / 2; levelCompletedText.y = 2732 / 2; self.addChild(levelCompletedText); var nextButton = new NextLevelButton(); self.addChild(nextButton); } } } } projectiles = projectiles.filter(function (projectile) { return !projectile._destroyed; }); }); var dots = []; var projectiles = []; var ammunition = 5; self.level = 1; var touchesLeftText = null; var levelText = new Text2('Lvl: ' + self.level, { size: 100 / 1.5, fill: '#ffffff' }); levelText.anchor.set(0, 1); LK.gui.bottomLeft.addChild(levelText); var levelCompleted = false; var level = 1; var instructionText = new Text2('Tap anywhere to make an explosion\nDestroy them all', { size: 100, fill: '#ffffff' }); instructionText.anchor.set(0.5, 0.5); instructionText.x = 2048 / 2; instructionText.y = 2732 / 2 - instructionText.height / 2; self.addChild(instructionText); var touchesLeftText = new Text2('Touches left: ' + ammunition, { size: 100 / 1.5, fill: '#ffffff' }); touchesLeftText.anchor.set(0, 0); LK.gui.topLeft.addChild(touchesLeftText); var targetsLeftText = new Text2('Targets left: ' + dots.length, { size: 100 / 1.5, fill: '#ffffff' }); targetsLeftText.anchor.set(1, 0); LK.gui.topRight.addChild(targetsLeftText); for (var i = 0; i < 5; i++) { var target = new Target(); target.x = Math.random() * 2048; target.y = Math.random() * 2732; dots.push(target); self.addChild(target); } targetsLeftText.setText('Targets left: ' + dots.length); LK.stage.on('down', function (obj) { if (instructionText) { instructionText.destroy(); instructionText = null; } if (ammunition > 0) { ammunition--; touchesLeftText.setText('Touches left: ' + ammunition); var event = obj.event; var pos = event.getLocalPosition(self); var directions = ['up', 'down', 'left', 'right']; directions.forEach(function (direction) { var projectile = new Projectile(direction); projectile.x = pos.x; projectile.y = pos.y; projectiles.push(projectile); self.addChild(projectile); }); } else if (dots.length > 0) { LK.showGameOver(); } targetsLeftText.setText('Targets left: ' + dots.length); }); });
===================================================================
--- original.js
+++ change.js
@@ -165,8 +165,10 @@
projectile.y = pos.y;
projectiles.push(projectile);
self.addChild(projectile);
});
+ } else if (dots.length > 0) {
+ LK.showGameOver();
}
targetsLeftText.setText('Targets left: ' + dots.length);
});
});
Simple flat icon, 200x200pixels, one bright color square with border. No shadows, top down view, transparent background. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Simple flat icon, 200x200pixels, one bright color circle with border. No shadows, top down view, transparent background. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Simple flat icon, 200x200pixels, one bright color diamond with border. No shadows, top down view, transparent background. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Simple flat icon, 200x200pixels, one bright color romb with border. No shadows, top down view, transparent background. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Simple flat icon, 200x200pixels, one bright color smiley with border. No shadows, top down view, transparent background. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
1024x1366 pixels, totally black no more than 20 very small, barely visible, stars here and there. Simple Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Single Game Texture, 50x50pix. In-Game asset. 2d. Blank background. High contrast. No shadows. Light green circle with border. Simple. No other objects. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.