User prompt
There’s a bug happening where with some enemies they won’t die once touched by the slapper. Fix it immediately or else.
User prompt
Make it so the will smith pop up says Switch to the Slapper? instead
User prompt
Please fix the bug: 'ReferenceError: Can't find variable: WillSmith' in or related to this line: 'if (!(hero instanceof WillSmith)) {' Line Number: 240
User prompt
Change will smiths name to the slapper
User prompt
Make it so the loot drops faster
User prompt
Make it so enemies drop loot
User prompt
Make it so the score only increases by 10 when will smith slaps an enemy, no matter what
User prompt
Make it so the enemies die when will smith slaps them and also make it so if an enemy reaches the bottom of the screen they game is over
User prompt
Make it so will smith never takes damage but he can’t shoot
User prompt
Will smith still takes damage when moving backwards to kill an enemy fix it
User prompt
Make it so if Will Smith is moving backward to kill an enemy he doesn’t take damage but if he is moving forward he does
User prompt
Make it so you can move Will Smith, like it was before
User prompt
Make the Will Smith choice at the beginning
User prompt
Make it so Will Smith can slap by tapping on the screen
User prompt
Make Will Smith come at 600 score and you have a pop up that gives you the choice to change to Will smith or stay normal. Will Smith has 3 life’s, and slaps enemies to kill them
User prompt
Add Will Smith
User prompt
Remove the bullets getting progressively faster and add the enemies spawning more progressively
User prompt
Make the game get progressively harder
User prompt
Make it so if one of the enemies gets to the bottom of the screen the game ends
User prompt
Make the game more difficult
User prompt
Give it an intro cutscene that lies and claims the game was made by Epic Games
Initial prompt
Fortnite 2: Fort Harder
/**** * Classes ****/ // Bullet class var Bullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.attachAsset('bullet', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -20; self.update = function () { self.y += self.speed; if (self.y < 0) { self.destroy(); } }; }); // Enemy class var Enemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.attachAsset('enemy', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 7; self.update = function () { self.y += self.speed; if (self.y > 2732) { self.destroy(); } }; }); //<Assets used in the game will automatically appear here> // Hero class var Hero = Container.expand(function () { var self = Container.call(this); var heroGraphics = self.attachAsset('hero', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 10; self.update = function () { // Hero update logic }; self.move = function (x, y) { self.prevX = self.x; self.prevY = self.y; self.x = x; self.y = y; self.isMovingBackward = self.y < self.prevY; }; }); var Loot = Container.expand(function () { var self = Container.call(this); var lootGraphics = self.attachAsset('loot', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 10; self.update = function () { self.y += self.speed; if (self.y > 2732) { self.destroy(); } }; }); var TheSlapper = Container.expand(function () { var self = Container.call(this); var theSlapperGraphics = self.attachAsset('theSlapper', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 10; self.lives = 3; self.update = function () { // The Slapper update logic }; self.move = function (x, y) { self.prevX = self.x; self.prevY = self.y; self.x = x; self.y = y; self.isMovingBackward = self.y < self.prevY; }; self.slap = function (enemy) { enemy.destroy(); score += 10; }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ // Show popup at the beginning to choose Will Smith var popupText = new Text2('Switch to the Slapper?', { size: 100, fill: "#ffffff", align: "center" }); popupText.anchor.set(0.5, 0.5); popupText.x = 1024; popupText.y = 1366; game.addChild(popupText); var yesButton = new Text2('Yes', { size: 100, fill: "#00ff00", align: "center" }); yesButton.anchor.set(0.5, 0.5); yesButton.x = 824; yesButton.y = 1566; game.addChild(yesButton); var noButton = new Text2('No', { size: 100, fill: "#ff0000", align: "center" }); noButton.anchor.set(0.5, 0.5); noButton.x = 1224; noButton.y = 1566; game.addChild(noButton); yesButton.down = function () { game.removeChild(popupText); game.removeChild(yesButton); game.removeChild(noButton); hero.destroy(); hero = game.addChild(new TheSlapper()); hero.x = 1024; hero.y = 2500; }; noButton.down = function () { game.removeChild(popupText); game.removeChild(yesButton); game.removeChild(noButton); }; // Intro cutscene var introText = new Text2('Fortnite 2: Fort Harder\n\nMade by Epic Games', { size: 100, fill: "#ffffff", align: "center" }); introText.anchor.set(0.5, 0.5); introText.x = 1024; introText.y = 1366; game.addChild(introText); // Fade out intro text after 3 seconds var introTimer = LK.setTimeout(function () { var fadeInterval = LK.setInterval(function () { introText.alpha -= 0.02; if (introText.alpha <= 0) { LK.clearInterval(fadeInterval); game.removeChild(introText); } }, 16.67); // Approximately 60 times per second }, 3000); // Initialize variables var hero = game.addChild(new Hero()); var willSmith = null; var willSmithPopupShown = false; hero.x = 1024; hero.y = 2500; var enemies = []; var bullets = []; var score = 0; // Create score text var scoreTxt = new Text2('0', { size: 150, fill: "#ffffff" }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Handle hero movement game.down = function (x, y, obj) { if (hero instanceof TheSlapper) { for (var i = enemies.length - 1; i >= 0; i--) { if (hero.intersects(enemies[i])) { hero.slap(enemies[i]); enemies.splice(i, 1); break; } } hero.move(x, y); // Add movement for Will Smith } else { hero.move(x, y); } }; game.move = function (x, y, obj) { hero.move(x, y); // Add movement for Will Smith }; game.up = function (x, y, obj) { // No action needed on up }; // Spawn enemies var spawnEnemy = function spawnEnemy() { var enemy = new Enemy(); enemy.x = Math.random() * 2048; enemy.y = 0; enemies.push(enemy); game.addChild(enemy); }; // Fire bullets var fireBullet = function fireBullet() { if (!(hero instanceof TheSlapper)) { var bullet = new Bullet(); bullet.x = hero.x; bullet.y = hero.y; bullets.push(bullet); game.addChild(bullet); } }; // Update game state game.update = function () { // Update score scoreTxt.setText(score); for (var i = enemies.length - 1; i >= 0; i--) { enemies[i].speed = 7 + Math.floor(score / 100); // Increase enemy speed as score increases enemies[i].update(); if (enemies[i].y >= 2732) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } else if (enemies[i].intersects(hero)) { if (!(hero instanceof TheSlapper)) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } } } // Update bullets for (var j = bullets.length - 1; j >= 0; j--) { bullets[j].speed = -20; // Bullet speed is constant bullets[j].update(); for (var k = enemies.length - 1; k >= 0; k--) { if (bullets[j].intersects(enemies[k])) { enemies[k].destroy(); var loot = new Loot(); loot.x = enemies[k].x; loot.y = enemies[k].y; game.addChild(loot); bullets[j].destroy(); enemies.splice(k, 1); bullets.splice(j, 1); score += 10; break; } } } // Check if slapper intersects with enemies if (hero instanceof TheSlapper) { for (var i = enemies.length - 1; i >= 0; i--) { if (hero.intersects(enemies[i])) { hero.slap(enemies[i]); enemies.splice(i, 1); break; } } } // Update loot for (var l = game.children.length - 1; l >= 0; l--) { if (game.children[l] instanceof Loot) { game.children[l].update(); if (hero.intersects(game.children[l])) { game.children[l].destroy(); score += 5; // Increase score by 5 when loot is collected } } } // Fire bullet every 30 ticks if (LK.ticks % 30 == 0) { fireBullet(); } // Spawn enemy more progressively if (LK.ticks % (50 - Math.floor(score / 100)) == 0) { spawnEnemy(); } };
===================================================================
--- original.js
+++ change.js
@@ -248,11 +248,17 @@
enemies.splice(k, 1);
bullets.splice(j, 1);
score += 10;
break;
- } else if (hero instanceof TheSlapper && hero.intersects(enemies[k])) {
- hero.slap(enemies[k]);
- enemies.splice(k, 1);
+ }
+ }
+ }
+ // Check if slapper intersects with enemies
+ if (hero instanceof TheSlapper) {
+ for (var i = enemies.length - 1; i >= 0; i--) {
+ if (hero.intersects(enemies[i])) {
+ hero.slap(enemies[i]);
+ enemies.splice(i, 1);
break;
}
}
}
A piece of gold. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A military general holding a rifle. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A bullet. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A military goon with a pocket knife. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
An insane, deranged man with a large right hand. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.