User prompt
ça ne marche pas mon level 1 montre le background 3
User prompt
Please fix the bug: 'ReferenceError: level is not defined' in or related to this line: 'if (self.currentLevel === 1 || level === 1) {' Line Number: 127
User prompt
le battle background est bloqué au 3 alors que level 1 =background 1 level 2 backrung 2 etc
User prompt
quand le joueur meurt il redémarre au level 1
User prompt
augmente la qualité d'image des background
User prompt
enlève le choix de selection de level quand tu lance le menu et enlève les infos laisse juste le bouton start
User prompt
ajoute un menu avant le jeu avec menu background ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'level is not defined' in or related to this line: 'if (level === 1) {' Line Number: 127
User prompt
change les battle background avec les level
User prompt
Import of asset
User prompt
Import of asset
User prompt
Import of asset
User prompt
Import of asset
User prompt
Import of asset
User prompt
Import of asset
User prompt
Please fix the bug: 'TypeError: battleSystem.playerTurn is not a function' in or related to this line: 'return self.attacks[index];' Line Number: 471
User prompt
Please fix the bug: 'TypeError: karen is null' in or related to this line: 'for (var i = 0; i < karen.attacks.length; i++) {' Line Number: 52
User prompt
Please fix the bug: 'TypeError: karen is undefined' in or related to this line: 'for (var i = 0; i < karen.attacks.length; i++) {' Line Number: 47
Code edit (1 edits merged)
Please save this source code
User prompt
Karen VS The World: Battle Royale
Initial prompt
karen VS the World, the famous karen meme fighting with fast food employee on first level, kid on 2nd one and manager on third on a Pokémon type fight
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1", { currentLevel: 1, highestLevel: 1 }); /**** * Classes ****/ var AttackMenu = Container.expand(function (karen) { var self = Container.call(this); self.visible = false; self.buttons = []; // Back button self.backButton = new BattleButton("Back", 0, 120, 'defendButton'); self.backButton.onSelect = function () { self.hide(); battleUI.showMainMenu(); }; self.addChild(self.backButton); self.showAttacks = function () { // Clear old attack buttons for (var i = 0; i < self.buttons.length; i++) { self.removeChild(self.buttons[i]); } self.buttons = []; // Create new attack buttons for (var i = 0; i < karen.attacks.length; i++) { var attack = karen.attacks[i]; var yPos = -150 + i * 80; var btn = new BattleButton(attack.name, 0, yPos, attack.special ? 'specialButton' : 'attackButton'); btn.attackIndex = i; btn.onSelect = function () { self.hide(); battleSystem.playerTurn(karen.getAttack(this.attackIndex)); }; self.addChild(btn); self.buttons.push(btn); } self.visible = true; }; self.hide = function () { self.visible = false; }; return self; }); var BattleButton = Container.expand(function (text, x, y, color) { var self = Container.call(this); self.button = self.attachAsset(color || 'attackButton', { anchorX: 0.5, anchorY: 0.5 }); self.text = new Text2(text, { size: 40, fill: 0xFFFFFF }); self.text.anchor.set(0.5, 0.5); self.addChild(self.text); self.x = x; self.y = y; self.setEnabled = function (enabled) { self.alpha = enabled ? 1.0 : 0.5; self.enabled = enabled; }; self.down = function (x, y, obj) { if (!self.enabled) { return; } tween(self, { scaleX: 0.9, scaleY: 0.9 }, { duration: 100 }); }; self.up = function (x, y, obj) { if (!self.enabled) { return; } tween(self, { scaleX: 1, scaleY: 1 }, { duration: 100 }); if (self.onSelect) { self.onSelect(); } }; self.setEnabled(true); return self; }); var BattleSystem = Container.expand(function () { var self = Container.call(this); self.battleBackground = self.attachAsset('battleBackground', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 0 }); self.currentEnemy = null; self.karen = null; self.currentLevel = storage.currentLevel || 1; self.playerTurn = true; self.gameOver = false; self.startBattle = function (level) { // Clean up previous battle if exists if (self.karen) { self.removeChild(self.karen); } if (self.currentEnemy) { self.removeChild(self.currentEnemy); } // Reset state self.playerTurn = true; self.gameOver = false; // Create karen self.karen = new Karen(); self.karen.x = -500; self.karen.y = 0; self.addChild(self.karen); // Create enemy based on level var enemyType; if (level === 1) { enemyType = "employee"; } else if (level === 2) { enemyType = "kid"; } else { enemyType = "manager"; } self.currentEnemy = new Enemy(enemyType); self.currentEnemy.x = 500; self.currentEnemy.y = 0; self.addChild(self.currentEnemy); // Update UI battleUI.setMessage("A wild " + self.currentEnemy.name + " appears!"); battleUI.enableButtons(true); battleUI.showMainMenu(); // Play battle music LK.playMusic('battleMusic'); }; self.playerTurn = function (attack) { if (!self.playerTurn || self.gameOver) { return; } // Disable buttons during animation battleUI.enableButtons(false); // Show attack message battleUI.setMessage("Karen uses " + attack.name + "!"); // Play attack sound LK.getSound(attack.special ? 'special' : 'attack').play(); // Animate karen tween(self.karen, { x: -300 }, { duration: 300, onFinish: function onFinish() { tween(self.karen, { x: -500 }, { duration: 300 }); } }); // Deal damage after animation delay LK.setTimeout(function () { var damage = attack.damage; if (attack.special) { damage = Math.floor(damage * 1.5); } var actualDamage = self.currentEnemy.takeDamage(damage); battleUI.setMessage("Dealt " + actualDamage + " damage!"); // Check if enemy is defeated if (self.currentEnemy.health <= 0) { self.enemyDefeated(); } else { // Switch to enemy turn after delay LK.setTimeout(function () { self.playerTurn = false; self.enemyTurn(); }, 1000); } }, 600); }; self.playerDefend = function () { if (!self.playerTurn || self.gameOver) { return; } // Disable buttons during animation battleUI.enableButtons(false); // Show defend message battleUI.setMessage("Karen prepares to defend!"); // Play defend sound LK.getSound('defend').play(); // Set defend flag self.karen.defend(); // Visual feedback tween(self.karen.visual, { alpha: 0.7 }, { duration: 300, onFinish: function onFinish() { tween(self.karen.visual, { alpha: 1 }, { duration: 300 }); } }); // Switch to enemy turn after delay LK.setTimeout(function () { self.playerTurn = false; self.enemyTurn(); }, 1000); }; self.playerSpecial = function () { if (!self.playerTurn || self.gameOver) { return; } // This is a special version of playerTurn for the "Speak to Manager" button // It will use the first special attack found for (var i = 0; i < self.karen.attacks.length; i++) { if (self.karen.attacks[i].special) { self.playerTurn(self.karen.attacks[i]); break; } } }; self.enemyTurn = function () { if (self.playerTurn || self.gameOver) { return; } // Get enemy action var action = self.currentEnemy.chooseAction(); // Show action message battleUI.setMessage(action.text); // Animate enemy tween(self.currentEnemy, { x: 300 }, { duration: 300, onFinish: function onFinish() { tween(self.currentEnemy, { x: 500 }, { duration: 300 }); } }); // Process action after animation delay LK.setTimeout(function () { if (action.type === "attack") { // Play attack sound LK.getSound('attack').play(); // Deal damage var damage = action.attack.damage; var actualDamage = self.karen.takeDamage(damage); battleUI.setMessage("You took " + actualDamage + " damage!"); // Check if player is defeated if (self.karen.health <= 0) { self.playerDefeated(); } else { // Switch to player turn after delay LK.setTimeout(function () { self.playerTurn = true; battleUI.setMessage("What will Karen do?"); battleUI.enableButtons(true); battleUI.showMainMenu(); }, 1000); } } else if (action.type === "defend") { // Play defend sound LK.getSound('defend').play(); // Visual feedback tween(self.currentEnemy.visual, { alpha: 0.7 }, { duration: 300, onFinish: function onFinish() { tween(self.currentEnemy.visual, { alpha: 1 }, { duration: 300 }); } }); // Switch to player turn after delay LK.setTimeout(function () { self.playerTurn = true; battleUI.setMessage("What will Karen do?"); battleUI.enableButtons(true); battleUI.showMainMenu(); }, 1000); } }, 600); }; self.enemyDefeated = function () { self.gameOver = true; // Play victory sound LK.getSound('victory').play(); // Show victory message battleUI.setMessage(self.currentEnemy.name + " has been defeated!"); // Update score based on remaining health var score = self.karen.health * 10; LK.setScore(LK.getScore() + score); // Show score message after delay LK.setTimeout(function () { battleUI.setMessage("You earned " + score + " points!"); // Progress to next level if not on final level if (self.currentLevel < 3) { self.currentLevel++; storage.currentLevel = self.currentLevel; if (self.currentLevel > storage.highestLevel) { storage.highestLevel = self.currentLevel; } // Start next battle after delay LK.setTimeout(function () { self.startBattle(self.currentLevel); }, 2000); } else { // Game completed LK.setTimeout(function () { battleUI.setMessage("Congratulations! You've defeated everyone!"); LK.setTimeout(function () { LK.showYouWin(); }, 2000); }, 2000); } }, 2000); }; self.playerDefeated = function () { self.gameOver = true; // Play defeat sound LK.getSound('defeat').play(); // Show defeat message battleUI.setMessage("Karen has been defeated!"); // Show game over after delay LK.setTimeout(function () { LK.showGameOver(); }, 2000); }; return self; }); var BattleUI = Container.expand(function () { var self = Container.call(this); // Battle message text self.messageText = new Text2("", { size: 40, fill: 0xFFFFFF }); self.messageText.anchor.set(0.5, 0); self.messageText.x = 0; self.messageText.y = -200; self.addChild(self.messageText); // Main menu buttons self.attackButton = new BattleButton("Attack", -450, 0); self.attackButton.onSelect = function () { self.hideMainMenu(); attackMenu.showAttacks(); }; self.addChild(self.attackButton); self.defendButton = new BattleButton("Defend", 0, 0, 'defendButton'); self.defendButton.onSelect = function () { self.hideMainMenu(); battleSystem.playerDefend(); }; self.addChild(self.defendButton); self.specialButton = new BattleButton("Speak to\nManager", 450, 0, 'specialButton'); self.specialButton.onSelect = function () { self.hideMainMenu(); battleSystem.playerSpecial(); }; self.addChild(self.specialButton); self.setMessage = function (message) { self.messageText.setText(message); }; self.enableButtons = function (enabled) { self.attackButton.setEnabled(enabled); self.defendButton.setEnabled(enabled); self.specialButton.setEnabled(enabled); }; self.hideMainMenu = function () { self.attackButton.visible = false; self.defendButton.visible = false; self.specialButton.visible = false; }; self.showMainMenu = function () { self.attackButton.visible = true; self.defendButton.visible = true; self.specialButton.visible = true; }; return self; }); var Character = Container.expand(function (name, maxHealth, attacks) { var self = Container.call(this); self.name = name; self.maxHealth = maxHealth; self.health = maxHealth; self.attacks = attacks || []; self.isDefending = false; // Create visual representation self.visual = null; self.takeDamage = function (amount) { if (self.isDefending) { amount = Math.floor(amount / 2); self.isDefending = false; } self.health = Math.max(0, self.health - amount); // Visual feedback var damageEffect = LK.getAsset('damageEffect', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 0, alpha: 0.7 }); self.addChild(damageEffect); tween(damageEffect, { alpha: 0 }, { duration: 500, onFinish: function onFinish() { damageEffect.destroy(); } }); // Update health bar if exists if (self.healthBar) { self.updateHealthBar(); } LK.getSound('hit').play(); return amount; }; self.defend = function () { self.isDefending = true; LK.getSound('defend').play(); return "defending"; }; self.heal = function (amount) { self.health = Math.min(self.maxHealth, self.health + amount); // Update health bar if exists if (self.healthBar) { self.updateHealthBar(); } return amount; }; self.getAttack = function (index) { return self.attacks[index]; }; self.createHealthBar = function () { // Create health bar background self.healthBarBg = LK.getAsset('healthBarBackground', { anchorX: 0, anchorY: 0, x: -200, y: -250 }); self.addChild(self.healthBarBg); // Create health bar self.healthBar = LK.getAsset('healthBar', { anchorX: 0, anchorY: 0, x: -200, y: -250 }); self.addChild(self.healthBar); // Create health text self.healthText = new Text2(self.health + "/" + self.maxHealth, { size: 30, fill: 0xFFFFFF }); self.healthText.anchor.set(0.5, 0.5); self.healthText.x = 0; self.healthText.y = -230; self.addChild(self.healthText); // Create name text self.nameText = new Text2(self.name, { size: 40, fill: 0xFFFFFF }); self.nameText.anchor.set(0.5, 0.5); self.nameText.x = 0; self.nameText.y = -280; self.addChild(self.nameText); }; self.updateHealthBar = function () { var healthPercent = self.health / self.maxHealth; self.healthBar.width = 400 * healthPercent; self.healthText.setText(self.health + "/" + self.maxHealth); }; return self; }); var Karen = Character.expand(function () { var self = Character.call(this, "Karen", 100, [{ name: "Angry Complaint", damage: 20, description: "A loud, angry verbal assault" }, { name: "Demand Manager", damage: 35, special: true, description: "The signature move! Summon the manager!" }, { name: "Fake Policy Citation", damage: 25, description: "Make up rules that don't exist" }, { name: "Social Media Threat", damage: 30, special: true, description: "Threaten to 'tell everyone online'" }]); self.visual = self.attachAsset('karen', { anchorX: 0.5, anchorY: 0.5 }); self.createHealthBar(); return self; }); var Enemy = Character.expand(function (type) { var self = Character.call(this); if (type === "employee") { self = Character.call(this, "Fast Food Employee", 80, [{ name: "Polite Refusal", damage: 10, description: "Calmly explain the rules" }, { name: "Eye Roll", damage: 15, description: "A subtle but effective eye roll" }, { name: "Call Coworker", damage: 20, description: "Get backup from a coworker" }]); self.visual = self.attachAsset('employee', { anchorX: 0.5, anchorY: 0.5 }); } else if (type === "kid") { self = Character.call(this, "Neighborhood Kid", 100, [{ name: "Ignore", damage: 15, description: "Completely ignore Karen's existence" }, { name: "Skateboard Trick", damage: 25, description: "Do a kickflip right in front of Karen" }, { name: "Ok Boomer", damage: 35, special: true, description: "The ultimate generational comeback" }]); self.visual = self.attachAsset('kid', { anchorX: 0.5, anchorY: 0.5 }); } else if (type === "manager") { self = Character.call(this, "The Manager", 120, [{ name: "Corporate Policy", damage: 20, description: "Cite the actual written policy" }, { name: "Security Call", damage: 30, description: "Threaten to call security" }, { name: "Lifetime Ban", damage: 40, special: true, description: "Ban Karen from the premises forever" }, { name: "Record Incident", damage: 25, description: "Start recording Karen with phone" }]); self.visual = self.attachAsset('manager', { anchorX: 0.5, anchorY: 0.5 }); } self.createHealthBar(); self.chooseAction = function () { // Simple AI - randomly choose an attack or defend var rand = Math.random(); if (self.health < self.maxHealth * 0.3 && rand < 0.3) { return { type: "defend", text: self.name + " prepares to defend!" }; } // Choose a random attack var attackIndex = Math.floor(Math.random() * self.attacks.length); var attack = self.attacks[attackIndex]; return { type: "attack", attack: attack, text: self.name + " uses " + attack.name + "!" }; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x222222 }); /**** * Game Code ****/ // Create main battle system var battleSystem = new BattleSystem(); battleSystem.x = 2048 / 2; battleSystem.y = 2732 / 2; game.addChild(battleSystem); // Create UI var battleUI = new BattleUI(); battleUI.x = 2048 / 2; battleUI.y = 2732 - 300; game.addChild(battleUI); // Create attack menu var attackMenu = new AttackMenu(); attackMenu.x = 2048 / 2; attackMenu.y = 2732 - 300; game.addChild(attackMenu); // Title var titleText = new Text2("Karen VS The World", { size: 100, fill: 0xFFFFFF }); titleText.anchor.set(0.5, 0.5); titleText.x = 2048 / 2; titleText.y = 200; game.addChild(titleText); // Subtitle var subtitleText = new Text2("Battle Royale", { size: 60, fill: 0xFFFFFF }); subtitleText.anchor.set(0.5, 0.5); subtitleText.x = 2048 / 2; subtitleText.y = 280; game.addChild(subtitleText); // Level text var levelText = new Text2("", { size: 50, fill: 0xFFFFFF }); levelText.anchor.set(0.5, 0.5); levelText.x = 2048 / 2; levelText.y = 380; game.addChild(levelText); // Scoreboard var scoreText = new Text2("Score: 0", { size: 50, fill: 0xFFFFFF }); scoreText.anchor.set(1, 0); scoreText.x = 2048 - 50; scoreText.y = 50; game.addChild(scoreText); // Start the game with appropriate level battleSystem.startBattle(battleSystem.currentLevel); // Update level text levelText.setText("Level " + battleSystem.currentLevel + "/3"); // Game update function game.update = function () { // Update score display scoreText.setText("Score: " + LK.getScore()); }; // Start the background music LK.playMusic('battleMusic');
===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,678 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+var storage = LK.import("@upit/storage.v1", {
+ currentLevel: 1,
+ highestLevel: 1
+});
+
+/****
+* Classes
+****/
+var AttackMenu = Container.expand(function (karen) {
+ var self = Container.call(this);
+ self.visible = false;
+ self.buttons = [];
+ // Back button
+ self.backButton = new BattleButton("Back", 0, 120, 'defendButton');
+ self.backButton.onSelect = function () {
+ self.hide();
+ battleUI.showMainMenu();
+ };
+ self.addChild(self.backButton);
+ self.showAttacks = function () {
+ // Clear old attack buttons
+ for (var i = 0; i < self.buttons.length; i++) {
+ self.removeChild(self.buttons[i]);
+ }
+ self.buttons = [];
+ // Create new attack buttons
+ for (var i = 0; i < karen.attacks.length; i++) {
+ var attack = karen.attacks[i];
+ var yPos = -150 + i * 80;
+ var btn = new BattleButton(attack.name, 0, yPos, attack.special ? 'specialButton' : 'attackButton');
+ btn.attackIndex = i;
+ btn.onSelect = function () {
+ self.hide();
+ battleSystem.playerTurn(karen.getAttack(this.attackIndex));
+ };
+ self.addChild(btn);
+ self.buttons.push(btn);
+ }
+ self.visible = true;
+ };
+ self.hide = function () {
+ self.visible = false;
+ };
+ return self;
+});
+var BattleButton = Container.expand(function (text, x, y, color) {
+ var self = Container.call(this);
+ self.button = self.attachAsset(color || 'attackButton', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.text = new Text2(text, {
+ size: 40,
+ fill: 0xFFFFFF
+ });
+ self.text.anchor.set(0.5, 0.5);
+ self.addChild(self.text);
+ self.x = x;
+ self.y = y;
+ self.setEnabled = function (enabled) {
+ self.alpha = enabled ? 1.0 : 0.5;
+ self.enabled = enabled;
+ };
+ self.down = function (x, y, obj) {
+ if (!self.enabled) {
+ return;
+ }
+ tween(self, {
+ scaleX: 0.9,
+ scaleY: 0.9
+ }, {
+ duration: 100
+ });
+ };
+ self.up = function (x, y, obj) {
+ if (!self.enabled) {
+ return;
+ }
+ tween(self, {
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 100
+ });
+ if (self.onSelect) {
+ self.onSelect();
+ }
+ };
+ self.setEnabled(true);
+ return self;
+});
+var BattleSystem = Container.expand(function () {
+ var self = Container.call(this);
+ self.battleBackground = self.attachAsset('battleBackground', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 0,
+ y: 0
+ });
+ self.currentEnemy = null;
+ self.karen = null;
+ self.currentLevel = storage.currentLevel || 1;
+ self.playerTurn = true;
+ self.gameOver = false;
+ self.startBattle = function (level) {
+ // Clean up previous battle if exists
+ if (self.karen) {
+ self.removeChild(self.karen);
+ }
+ if (self.currentEnemy) {
+ self.removeChild(self.currentEnemy);
+ }
+ // Reset state
+ self.playerTurn = true;
+ self.gameOver = false;
+ // Create karen
+ self.karen = new Karen();
+ self.karen.x = -500;
+ self.karen.y = 0;
+ self.addChild(self.karen);
+ // Create enemy based on level
+ var enemyType;
+ if (level === 1) {
+ enemyType = "employee";
+ } else if (level === 2) {
+ enemyType = "kid";
+ } else {
+ enemyType = "manager";
+ }
+ self.currentEnemy = new Enemy(enemyType);
+ self.currentEnemy.x = 500;
+ self.currentEnemy.y = 0;
+ self.addChild(self.currentEnemy);
+ // Update UI
+ battleUI.setMessage("A wild " + self.currentEnemy.name + " appears!");
+ battleUI.enableButtons(true);
+ battleUI.showMainMenu();
+ // Play battle music
+ LK.playMusic('battleMusic');
+ };
+ self.playerTurn = function (attack) {
+ if (!self.playerTurn || self.gameOver) {
+ return;
+ }
+ // Disable buttons during animation
+ battleUI.enableButtons(false);
+ // Show attack message
+ battleUI.setMessage("Karen uses " + attack.name + "!");
+ // Play attack sound
+ LK.getSound(attack.special ? 'special' : 'attack').play();
+ // Animate karen
+ tween(self.karen, {
+ x: -300
+ }, {
+ duration: 300,
+ onFinish: function onFinish() {
+ tween(self.karen, {
+ x: -500
+ }, {
+ duration: 300
+ });
+ }
+ });
+ // Deal damage after animation delay
+ LK.setTimeout(function () {
+ var damage = attack.damage;
+ if (attack.special) {
+ damage = Math.floor(damage * 1.5);
+ }
+ var actualDamage = self.currentEnemy.takeDamage(damage);
+ battleUI.setMessage("Dealt " + actualDamage + " damage!");
+ // Check if enemy is defeated
+ if (self.currentEnemy.health <= 0) {
+ self.enemyDefeated();
+ } else {
+ // Switch to enemy turn after delay
+ LK.setTimeout(function () {
+ self.playerTurn = false;
+ self.enemyTurn();
+ }, 1000);
+ }
+ }, 600);
+ };
+ self.playerDefend = function () {
+ if (!self.playerTurn || self.gameOver) {
+ return;
+ }
+ // Disable buttons during animation
+ battleUI.enableButtons(false);
+ // Show defend message
+ battleUI.setMessage("Karen prepares to defend!");
+ // Play defend sound
+ LK.getSound('defend').play();
+ // Set defend flag
+ self.karen.defend();
+ // Visual feedback
+ tween(self.karen.visual, {
+ alpha: 0.7
+ }, {
+ duration: 300,
+ onFinish: function onFinish() {
+ tween(self.karen.visual, {
+ alpha: 1
+ }, {
+ duration: 300
+ });
+ }
+ });
+ // Switch to enemy turn after delay
+ LK.setTimeout(function () {
+ self.playerTurn = false;
+ self.enemyTurn();
+ }, 1000);
+ };
+ self.playerSpecial = function () {
+ if (!self.playerTurn || self.gameOver) {
+ return;
+ }
+ // This is a special version of playerTurn for the "Speak to Manager" button
+ // It will use the first special attack found
+ for (var i = 0; i < self.karen.attacks.length; i++) {
+ if (self.karen.attacks[i].special) {
+ self.playerTurn(self.karen.attacks[i]);
+ break;
+ }
+ }
+ };
+ self.enemyTurn = function () {
+ if (self.playerTurn || self.gameOver) {
+ return;
+ }
+ // Get enemy action
+ var action = self.currentEnemy.chooseAction();
+ // Show action message
+ battleUI.setMessage(action.text);
+ // Animate enemy
+ tween(self.currentEnemy, {
+ x: 300
+ }, {
+ duration: 300,
+ onFinish: function onFinish() {
+ tween(self.currentEnemy, {
+ x: 500
+ }, {
+ duration: 300
+ });
+ }
+ });
+ // Process action after animation delay
+ LK.setTimeout(function () {
+ if (action.type === "attack") {
+ // Play attack sound
+ LK.getSound('attack').play();
+ // Deal damage
+ var damage = action.attack.damage;
+ var actualDamage = self.karen.takeDamage(damage);
+ battleUI.setMessage("You took " + actualDamage + " damage!");
+ // Check if player is defeated
+ if (self.karen.health <= 0) {
+ self.playerDefeated();
+ } else {
+ // Switch to player turn after delay
+ LK.setTimeout(function () {
+ self.playerTurn = true;
+ battleUI.setMessage("What will Karen do?");
+ battleUI.enableButtons(true);
+ battleUI.showMainMenu();
+ }, 1000);
+ }
+ } else if (action.type === "defend") {
+ // Play defend sound
+ LK.getSound('defend').play();
+ // Visual feedback
+ tween(self.currentEnemy.visual, {
+ alpha: 0.7
+ }, {
+ duration: 300,
+ onFinish: function onFinish() {
+ tween(self.currentEnemy.visual, {
+ alpha: 1
+ }, {
+ duration: 300
+ });
+ }
+ });
+ // Switch to player turn after delay
+ LK.setTimeout(function () {
+ self.playerTurn = true;
+ battleUI.setMessage("What will Karen do?");
+ battleUI.enableButtons(true);
+ battleUI.showMainMenu();
+ }, 1000);
+ }
+ }, 600);
+ };
+ self.enemyDefeated = function () {
+ self.gameOver = true;
+ // Play victory sound
+ LK.getSound('victory').play();
+ // Show victory message
+ battleUI.setMessage(self.currentEnemy.name + " has been defeated!");
+ // Update score based on remaining health
+ var score = self.karen.health * 10;
+ LK.setScore(LK.getScore() + score);
+ // Show score message after delay
+ LK.setTimeout(function () {
+ battleUI.setMessage("You earned " + score + " points!");
+ // Progress to next level if not on final level
+ if (self.currentLevel < 3) {
+ self.currentLevel++;
+ storage.currentLevel = self.currentLevel;
+ if (self.currentLevel > storage.highestLevel) {
+ storage.highestLevel = self.currentLevel;
+ }
+ // Start next battle after delay
+ LK.setTimeout(function () {
+ self.startBattle(self.currentLevel);
+ }, 2000);
+ } else {
+ // Game completed
+ LK.setTimeout(function () {
+ battleUI.setMessage("Congratulations! You've defeated everyone!");
+ LK.setTimeout(function () {
+ LK.showYouWin();
+ }, 2000);
+ }, 2000);
+ }
+ }, 2000);
+ };
+ self.playerDefeated = function () {
+ self.gameOver = true;
+ // Play defeat sound
+ LK.getSound('defeat').play();
+ // Show defeat message
+ battleUI.setMessage("Karen has been defeated!");
+ // Show game over after delay
+ LK.setTimeout(function () {
+ LK.showGameOver();
+ }, 2000);
+ };
+ return self;
+});
+var BattleUI = Container.expand(function () {
+ var self = Container.call(this);
+ // Battle message text
+ self.messageText = new Text2("", {
+ size: 40,
+ fill: 0xFFFFFF
+ });
+ self.messageText.anchor.set(0.5, 0);
+ self.messageText.x = 0;
+ self.messageText.y = -200;
+ self.addChild(self.messageText);
+ // Main menu buttons
+ self.attackButton = new BattleButton("Attack", -450, 0);
+ self.attackButton.onSelect = function () {
+ self.hideMainMenu();
+ attackMenu.showAttacks();
+ };
+ self.addChild(self.attackButton);
+ self.defendButton = new BattleButton("Defend", 0, 0, 'defendButton');
+ self.defendButton.onSelect = function () {
+ self.hideMainMenu();
+ battleSystem.playerDefend();
+ };
+ self.addChild(self.defendButton);
+ self.specialButton = new BattleButton("Speak to\nManager", 450, 0, 'specialButton');
+ self.specialButton.onSelect = function () {
+ self.hideMainMenu();
+ battleSystem.playerSpecial();
+ };
+ self.addChild(self.specialButton);
+ self.setMessage = function (message) {
+ self.messageText.setText(message);
+ };
+ self.enableButtons = function (enabled) {
+ self.attackButton.setEnabled(enabled);
+ self.defendButton.setEnabled(enabled);
+ self.specialButton.setEnabled(enabled);
+ };
+ self.hideMainMenu = function () {
+ self.attackButton.visible = false;
+ self.defendButton.visible = false;
+ self.specialButton.visible = false;
+ };
+ self.showMainMenu = function () {
+ self.attackButton.visible = true;
+ self.defendButton.visible = true;
+ self.specialButton.visible = true;
+ };
+ return self;
+});
+var Character = Container.expand(function (name, maxHealth, attacks) {
+ var self = Container.call(this);
+ self.name = name;
+ self.maxHealth = maxHealth;
+ self.health = maxHealth;
+ self.attacks = attacks || [];
+ self.isDefending = false;
+ // Create visual representation
+ self.visual = null;
+ self.takeDamage = function (amount) {
+ if (self.isDefending) {
+ amount = Math.floor(amount / 2);
+ self.isDefending = false;
+ }
+ self.health = Math.max(0, self.health - amount);
+ // Visual feedback
+ var damageEffect = LK.getAsset('damageEffect', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 0,
+ y: 0,
+ alpha: 0.7
+ });
+ self.addChild(damageEffect);
+ tween(damageEffect, {
+ alpha: 0
+ }, {
+ duration: 500,
+ onFinish: function onFinish() {
+ damageEffect.destroy();
+ }
+ });
+ // Update health bar if exists
+ if (self.healthBar) {
+ self.updateHealthBar();
+ }
+ LK.getSound('hit').play();
+ return amount;
+ };
+ self.defend = function () {
+ self.isDefending = true;
+ LK.getSound('defend').play();
+ return "defending";
+ };
+ self.heal = function (amount) {
+ self.health = Math.min(self.maxHealth, self.health + amount);
+ // Update health bar if exists
+ if (self.healthBar) {
+ self.updateHealthBar();
+ }
+ return amount;
+ };
+ self.getAttack = function (index) {
+ return self.attacks[index];
+ };
+ self.createHealthBar = function () {
+ // Create health bar background
+ self.healthBarBg = LK.getAsset('healthBarBackground', {
+ anchorX: 0,
+ anchorY: 0,
+ x: -200,
+ y: -250
+ });
+ self.addChild(self.healthBarBg);
+ // Create health bar
+ self.healthBar = LK.getAsset('healthBar', {
+ anchorX: 0,
+ anchorY: 0,
+ x: -200,
+ y: -250
+ });
+ self.addChild(self.healthBar);
+ // Create health text
+ self.healthText = new Text2(self.health + "/" + self.maxHealth, {
+ size: 30,
+ fill: 0xFFFFFF
+ });
+ self.healthText.anchor.set(0.5, 0.5);
+ self.healthText.x = 0;
+ self.healthText.y = -230;
+ self.addChild(self.healthText);
+ // Create name text
+ self.nameText = new Text2(self.name, {
+ size: 40,
+ fill: 0xFFFFFF
+ });
+ self.nameText.anchor.set(0.5, 0.5);
+ self.nameText.x = 0;
+ self.nameText.y = -280;
+ self.addChild(self.nameText);
+ };
+ self.updateHealthBar = function () {
+ var healthPercent = self.health / self.maxHealth;
+ self.healthBar.width = 400 * healthPercent;
+ self.healthText.setText(self.health + "/" + self.maxHealth);
+ };
+ return self;
+});
+var Karen = Character.expand(function () {
+ var self = Character.call(this, "Karen", 100, [{
+ name: "Angry Complaint",
+ damage: 20,
+ description: "A loud, angry verbal assault"
+ }, {
+ name: "Demand Manager",
+ damage: 35,
+ special: true,
+ description: "The signature move! Summon the manager!"
+ }, {
+ name: "Fake Policy Citation",
+ damage: 25,
+ description: "Make up rules that don't exist"
+ }, {
+ name: "Social Media Threat",
+ damage: 30,
+ special: true,
+ description: "Threaten to 'tell everyone online'"
+ }]);
+ self.visual = self.attachAsset('karen', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.createHealthBar();
+ return self;
+});
+var Enemy = Character.expand(function (type) {
+ var self = Character.call(this);
+ if (type === "employee") {
+ self = Character.call(this, "Fast Food Employee", 80, [{
+ name: "Polite Refusal",
+ damage: 10,
+ description: "Calmly explain the rules"
+ }, {
+ name: "Eye Roll",
+ damage: 15,
+ description: "A subtle but effective eye roll"
+ }, {
+ name: "Call Coworker",
+ damage: 20,
+ description: "Get backup from a coworker"
+ }]);
+ self.visual = self.attachAsset('employee', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ } else if (type === "kid") {
+ self = Character.call(this, "Neighborhood Kid", 100, [{
+ name: "Ignore",
+ damage: 15,
+ description: "Completely ignore Karen's existence"
+ }, {
+ name: "Skateboard Trick",
+ damage: 25,
+ description: "Do a kickflip right in front of Karen"
+ }, {
+ name: "Ok Boomer",
+ damage: 35,
+ special: true,
+ description: "The ultimate generational comeback"
+ }]);
+ self.visual = self.attachAsset('kid', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ } else if (type === "manager") {
+ self = Character.call(this, "The Manager", 120, [{
+ name: "Corporate Policy",
+ damage: 20,
+ description: "Cite the actual written policy"
+ }, {
+ name: "Security Call",
+ damage: 30,
+ description: "Threaten to call security"
+ }, {
+ name: "Lifetime Ban",
+ damage: 40,
+ special: true,
+ description: "Ban Karen from the premises forever"
+ }, {
+ name: "Record Incident",
+ damage: 25,
+ description: "Start recording Karen with phone"
+ }]);
+ self.visual = self.attachAsset('manager', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ }
+ self.createHealthBar();
+ self.chooseAction = function () {
+ // Simple AI - randomly choose an attack or defend
+ var rand = Math.random();
+ if (self.health < self.maxHealth * 0.3 && rand < 0.3) {
+ return {
+ type: "defend",
+ text: self.name + " prepares to defend!"
+ };
+ }
+ // Choose a random attack
+ var attackIndex = Math.floor(Math.random() * self.attacks.length);
+ var attack = self.attacks[attackIndex];
+ return {
+ type: "attack",
+ attack: attack,
+ text: self.name + " uses " + attack.name + "!"
+ };
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x222222
+});
+
+/****
+* Game Code
+****/
+// Create main battle system
+var battleSystem = new BattleSystem();
+battleSystem.x = 2048 / 2;
+battleSystem.y = 2732 / 2;
+game.addChild(battleSystem);
+// Create UI
+var battleUI = new BattleUI();
+battleUI.x = 2048 / 2;
+battleUI.y = 2732 - 300;
+game.addChild(battleUI);
+// Create attack menu
+var attackMenu = new AttackMenu();
+attackMenu.x = 2048 / 2;
+attackMenu.y = 2732 - 300;
+game.addChild(attackMenu);
+// Title
+var titleText = new Text2("Karen VS The World", {
+ size: 100,
+ fill: 0xFFFFFF
+});
+titleText.anchor.set(0.5, 0.5);
+titleText.x = 2048 / 2;
+titleText.y = 200;
+game.addChild(titleText);
+// Subtitle
+var subtitleText = new Text2("Battle Royale", {
+ size: 60,
+ fill: 0xFFFFFF
+});
+subtitleText.anchor.set(0.5, 0.5);
+subtitleText.x = 2048 / 2;
+subtitleText.y = 280;
+game.addChild(subtitleText);
+// Level text
+var levelText = new Text2("", {
+ size: 50,
+ fill: 0xFFFFFF
+});
+levelText.anchor.set(0.5, 0.5);
+levelText.x = 2048 / 2;
+levelText.y = 380;
+game.addChild(levelText);
+// Scoreboard
+var scoreText = new Text2("Score: 0", {
+ size: 50,
+ fill: 0xFFFFFF
+});
+scoreText.anchor.set(1, 0);
+scoreText.x = 2048 - 50;
+scoreText.y = 50;
+game.addChild(scoreText);
+// Start the game with appropriate level
+battleSystem.startBattle(battleSystem.currentLevel);
+// Update level text
+levelText.setText("Level " + battleSystem.currentLevel + "/3");
+// Game update function
+game.update = function () {
+ // Update score display
+ scoreText.setText("Score: " + LK.getScore());
+};
+// Start the background music
+LK.playMusic('battleMusic');
\ No newline at end of file
karen a white blonde woman from the meme "karen" screaming and point her finger to the right. Single Game Texture. In-Game asset. 2d. High contrast. No shadows
kid with a ball Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
fast food employee. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
insde manager office. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
manager character upper body part. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
excuseme
Sound effect
writingreview
Sound effect
unacceptable
Sound effect
askmanager
Sound effect
payyoursalary
Sound effect
knowmyrights
Sound effect
knowtheowner
Sound effect
securityplease
Sound effect
istherecarin
Sound effect
misscalmdown
Sound effect
complainform
Sound effect
whatareyoudoing
Sound effect
police
Sound effect
talktoparents
Sound effect
privateproperty
Sound effect
gettinghurt
Sound effect
victory
Sound effect
ignoring
Sound effect
okboomer
Sound effect
viralontiktok
Sound effect
affraidofaballoon
Sound effect
protocol
Sound effect
giveananswer
Sound effect
therules
Sound effect
justiceattack
Sound effect
incompetent
Sound effect
totalrefund
Sound effect
notmyproblem
Sound effect
knwowhoiam
Sound effect
jingleremix
Music
gtasound
Music
office
Music