Code edit (1 edits merged)
Please save this source code
User prompt
change les attaques de Karen du troisième combat /level pour aller avec les sons : unnacceptable, knowmyrights, justice attack et totalrefund
User prompt
les attaques du kid doivent play les sounds correspondants
Code edit (1 edits merged)
Please save this source code
User prompt
ok change les attaques du kid pour utiliser les assets sounds : ignoring, okboomer, affraidofaballon, viralontiktok
User prompt
make the victory sound a bit delay when defeating ennemies because its playing same time as the action ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Import of sound asset
User prompt
add gettinghurt sound to faking getting hurt, callpolice to call the police, talktoparents to Talk to Parents et privateproperty to Private Property
User prompt
les attaques sont toujours celles du level 1 pourquoi ?
User prompt
change karen attack in level 2 for "call the police" "talk to parents" "faking getting hurt" "private property"
User prompt
add whatareyoudoing asset and play it on the starting of the second level
User prompt
add excuseme sound and play it when starting the first level
User prompt
Modify BattleButton to ensure all buttons have the same size and not scaling down on press
User prompt
enlève la mention ennemy uses et karen uses de la message box lors des attaques
User prompt
the sound should be played when the ennemy attack
User prompt
add the sound to the employee attack
User prompt
let more time for read the message box when attacking and getting attack
User prompt
remove the damage message from the message box whenn player or ennemy attack
User prompt
when player replay after the win it should restart from level 1
User prompt
remove the level info and the score of the player screen, also remove totally the scor system
User prompt
lorsque karen combat le neighbourhood kid c'est le level2 et doit enclencher le background 2
User prompt
les boutons d'actions ne doivent pas rétrécir une fois utilisé
User prompt
adapte la taille de la message box pour que le texte ne dépasse pas lors des longs messages
User prompt
add the sound to fast food employee attack : securityplease, complainform, istherecarin, misscalmown
User prompt
make the start game button lower
/**** * 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.executePlayerTurn(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, font: "Impact" }); 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; }; // Store original scale values when button is created self.originalScaleX = self.scale.x; self.originalScaleY = self.scale.y; self.down = function (x, y, obj) { if (!self.enabled) { return; } // Use button graphic scale change instead of the entire container tween(self.button, { scaleX: 0.9, scaleY: 0.9 }, { duration: 100 }); }; self.up = function (x, y, obj) { if (!self.enabled) { return; } // Reset button graphic scale instead of the entire container tween(self.button, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100 }); if (self.onSelect) { self.onSelect(); } }; self.setEnabled(true); return self; }); var BattleSystem = Container.expand(function () { var self = Container.call(this); // Remove existing background if it exists if (self.battleBackground) { self.removeChild(self.battleBackground); } // Set background based on current level if (self.currentLevel === 1 || storage.currentLevel === 1) { self.battleBackground = self.attachAsset('battleBackground', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 0, scaleX: 1.2, scaleY: 1.2 }); } else if (self.currentLevel === 2 || storage.currentLevel === 2) { self.battleBackground = self.attachAsset('battlebackground2', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 0, scaleX: 2.0, scaleY: 1.6 }); } else { self.battleBackground = self.attachAsset('battlebackground3', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 0, scaleX: 3.4, scaleY: 2.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; // Set current level self.currentLevel = level; // Update background for the new level if (self.battleBackground) { self.removeChild(self.battleBackground); } if (level === 1) { self.battleBackground = self.attachAsset('battleBackground', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 0, scaleX: 1.2, scaleY: 1.2 }); } else if (level === 2) { self.battleBackground = self.attachAsset('battlebackground2', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 0, scaleX: 2.0, scaleY: 1.6 }); } else { self.battleBackground = self.attachAsset('battlebackground3', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 0, scaleX: 3.4, scaleY: 2.0 }); } self.addChild(self.battleBackground); // Create karen with level-specific attacks self.karen = new Karen(); // Update Karen's attacks based on level if (level === 1) { self.karen.attacks = [{ name: "Demand Manager", damage: 20, description: "Karen demanded to see the manager!" }, { name: "I know the owner !!", damage: 25, description: "Karen claims to know the owner!" }, { name: "Write a 1 star review !", damage: 30, description: "Karen threatened a bad review!" }, { name: "Your salary", damage: 35, description: "Karen threatened about employee's salary!" }]; } else if (level === 2) { self.karen.attacks = [{ name: "Call the police", damage: 20, description: "Karen threatens to call the police on the kid" }, { name: "Talk to parents", damage: 25, description: "Karen demands to speak with the kid's parents" }, { name: "Faking getting hurt", damage: 35, special: true, description: "Karen pretends to be injured by the kid" }, { name: "Private property", damage: 30, description: "Karen claims the kid is trespassing on private property" }]; } else if (level === 3) { self.karen.attacks = [{ name: "Lawsuit Threat", damage: 25, description: "Karen threatens to sue the business" }, { name: "I know my rights !!", damage: 30, description: "Karen insists she knows her legal rights" }, { name: "Unacceptable !!", damage: 40, special: true, description: "Karen screams 'UNACCEPTABLE!' at top volume" }, { name: "Social Media Blast", damage: 35, description: "Karen threatens to post about this on all platforms" }]; } 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!"); // Update button texts based on Karen's current attacks battleUI.attackButton1.text.setText(self.karen.attacks[0].name); battleUI.attackButton1.attackData = self.karen.attacks[0]; battleUI.attackButton2.text.setText(self.karen.attacks[1].name); battleUI.attackButton2.attackData = self.karen.attacks[1]; battleUI.attackButton3.text.setText(self.karen.attacks[2].name); battleUI.attackButton3.attackData = self.karen.attacks[2]; battleUI.attackButton4.text.setText(self.karen.attacks[3].name); battleUI.attackButton4.attackData = self.karen.attacks[3]; // Wait a moment then show "What will Karen do?" LK.setTimeout(function () { battleUI.setMessage("What will Karen do?"); }, 2000); battleUI.enableButtons(true); battleUI.showMainMenu(); // Play appropriate sound based on level if (level === 1) { LK.getSound('excuseme').play(); } else if (level === 2) { LK.getSound('whatareyoudoing').play(); } // Play battle music LK.playMusic('battleMusic'); }; self.executePlayerTurn = function (attack) { if (!self.playerTurn || self.gameOver) { return; } // Disable buttons during animation battleUI.enableButtons(false); // Show attack message battleUI.setMessage(attack.name + "! " + (attack.description ? attack.description : "")); // Play attack sound LK.getSound('attack').play(); if (attack.name === "Demand Manager") { LK.getSound('askmanager').play(); } else if (attack.name === "I know the owner !!") { LK.getSound('knowtheowner').play(); } else if (attack.name === "Write a 1 star review !") { LK.getSound('writingreview').play(); } else if (attack.name === "Your salary") { LK.getSound('payyoursalary').play(); } else if (attack.name === "Security Please") { LK.getSound('securityplease').play(); } else if (attack.name === "Complaint Form") { LK.getSound('complainform').play(); } else if (attack.name === "Is there a Carin") { LK.getSound('istherecarin').play(); } else if (attack.name === "Miss Calm Down") { LK.getSound('misscalmdown').play(); } else if (attack.name === "Faking getting hurt") { LK.getSound('gettinghurt').play(); } else if (attack.name === "Call the police") { LK.getSound('police').play(); } else if (attack.name === "Talk to parents") { LK.getSound('talktoparents').play(); } else if (attack.name === "Private property") { LK.getSound('privateproperty').play(); } else { 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); // Removed damage message display // 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(); }, 3000); } }, 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(); }, 3000); }; 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(); if (action.attack.name === "Is there a Carin") { LK.getSound('istherecarin').play(); } else if (action.attack.name === "Security Please") { LK.getSound('securityplease').play(); } else if (action.attack.name === "Miss Calm Down") { LK.getSound('misscalmdown').play(); } else if (action.attack.name === "Complaint Form") { LK.getSound('complainform').play(); } else if (action.attack.name === "Ignore" || action.attack.name === "Skateboard Trick" || action.attack.name === "Ok Boomer") { // Kid sounds could be added here if available } else if (action.attack.name === "Corporate Policy" || action.attack.name === "Security Call" || action.attack.name === "Lifetime Ban" || action.attack.name === "Record Incident") { // Manager sounds could be added here if available } // Deal damage var damage = action.attack.damage; var actualDamage = self.karen.takeDamage(damage); // Removed damage message display // 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(); }, 3000); } } 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(); }, 3000); } }, 600); }; self.enemyDefeated = function () { self.gameOver = true; // Show victory message first battleUI.setMessage(self.currentEnemy.name + " has been defeated!"); // Delay victory sound to avoid overlap with attack sound LK.setTimeout(function () { // Play victory sound after delay LK.getSound('victory').play(); }, 1000); // Score system removed LK.setTimeout(function () { battleUI.setMessage("You won!"); // 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 () { // Reset to level 1 for next game self.currentLevel = 1; storage.currentLevel = 1; 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!"); // Reset to level 1 self.currentLevel = 1; storage.currentLevel = 1; // 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, font: "Impact" }); self.messageText.anchor.set(0.5, 0); self.messageText.x = 0; self.messageText.y = -200; self.addChild(self.messageText); // Karen's attack buttons var karenMoves = [{ name: "Demand Manager", damage: 20, defense: 0, description: "Karen demanded to see the manager!" }, { name: "I know the owner !!", damage: 25, defense: 0, description: "Karen claims to know the owner!" }, { name: "Write a 1 star review !", damage: 30, defense: 0, description: "Karen threatened a bad review!" }, { name: "Your salary", damage: 35, defense: 0, description: "Karen threatened about employee's salary!" }]; self.attackButton1 = new BattleButton(karenMoves[0].name, -600, -80); self.attackButton1.attackData = karenMoves[0]; self.attackButton1.scale.set(1.5, 1.5); // Increase button size self.attackButton1.onSelect = function () { self.hideMainMenu(); battleSystem.executePlayerTurn(this.attackData); }; self.addChild(self.attackButton1); self.attackButton2 = new BattleButton(karenMoves[1].name, -600, 80); self.attackButton2.attackData = karenMoves[1]; self.attackButton2.scale.set(1.5, 1.5); // Increase button size self.attackButton2.onSelect = function () { self.hideMainMenu(); battleSystem.executePlayerTurn(this.attackData); }; self.addChild(self.attackButton2); self.attackButton3 = new BattleButton(karenMoves[2].name, 600, -80, 'attackButton'); self.attackButton3.attackData = karenMoves[2]; self.attackButton3.scale.set(1.5, 1.5); // Increase button size self.attackButton3.onSelect = function () { self.hideMainMenu(); battleSystem.executePlayerTurn(this.attackData); }; self.addChild(self.attackButton3); self.attackButton4 = new BattleButton(karenMoves[3].name, 600, 80, 'attackButton'); self.attackButton4.attackData = karenMoves[3]; self.attackButton4.scale.set(1.5, 1.5); // Increase button size self.attackButton4.onSelect = function () { self.hideMainMenu(); battleSystem.executePlayerTurn(this.attackData); }; self.addChild(self.attackButton4); self.setMessage = function (message) { // Use only the message box for displaying messages if (messageBox) { messageBox.setMessage(message); messageBox.show(); } }; self.enableButtons = function (enabled) { self.attackButton1.setEnabled(enabled); self.attackButton2.setEnabled(enabled); self.attackButton3.setEnabled(enabled); self.attackButton4.setEnabled(enabled); }; self.hideMainMenu = function () { self.attackButton1.visible = false; self.attackButton2.visible = false; self.attackButton3.visible = false; self.attackButton4.visible = false; }; self.showMainMenu = function () { self.attackButton1.visible = true; self.attackButton2.visible = true; self.attackButton3.visible = true; self.attackButton4.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.5, anchorY: 0.5, x: 0, y: 300 }); self.addChild(self.healthBarBg); // Create health bar self.healthBar = LK.getAsset('healthBar', { anchorX: 0, anchorY: 0.5, x: -200, y: 300 }); self.addChild(self.healthBar); // Create health text self.healthText = new Text2(self.health + "/" + self.maxHealth, { size: 30, fill: 0xFFFFFF, font: "Impact" }); self.healthText.anchor.set(0.5, 0.5); self.healthText.x = 0; self.healthText.y = 300; self.addChild(self.healthText); // Create name text self.nameText = new Text2(self.name, { size: 40, fill: 0xFFFFFF, font: "Impact" }); self.nameText.anchor.set(0.5, 0.5); self.nameText.x = 0; self.nameText.y = 380; 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: "Demand Manager", damage: 20, description: "Karen demanded to see the manager!" }, { name: "I know the owner !!", damage: 25, description: "Karen claims to know the owner!" }, { name: "Write a 1 star review !", damage: 30, description: "Karen threatened a bad review!" }, { name: "Your salary", damage: 35, description: "Karen threatened about employee's salary!" }]); 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", 100, [{ name: "Is there a Carin", damage: 0, defense: 15, description: "Asked if there is another Karen named Carin!" }, { name: "Security Please", damage: 30, defense: 0, description: "Called security for assistance!" }, { name: "Miss Calm Down", damage: 15, defense: 5, description: "Asked Karen to please calm down..." }, { name: "Complaint Form", damage: 25, defense: 0, description: "Offered a formal complaint form to fill." }]); 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: "Kid ignores Karen completely" }, { name: "Skateboard Trick", damage: 25, description: "Does a cool skateboard trick in front of Karen" }, { name: "Ok Boomer", damage: 35, special: true, description: "Kid says 'OK Boomer' and keeps playing" }, { name: "Film For TikTok", damage: 30, description: "Starts filming Karen for a viral TikTok" }]); 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: attack.name + "! " + (attack.description ? attack.description : "") }; }; return self; }); var MainMenu = Container.expand(function () { var self = Container.call(this); // Add menu background self.background = self.attachAsset('menubackground', { anchorX: 0.5, anchorY: 0.5 }); // Remove title and subtitle text for cleaner look // Start Button - bigger and lower on screen self.startButton = new BattleButton("Start Game", 0, 500, 'attackButton'); self.startButton.scale.set(2.0, 2.0); // Make button significantly bigger self.startButton.onSelect = function () { self.onStartGame(); }; self.addChild(self.startButton); // Level select if player has unlocked additional levels self.levelButtons = []; self.updateLevelButtons = function () { // Clear existing buttons for (var i = 0; i < self.levelButtons.length; i++) { self.removeChild(self.levelButtons[i]); } self.levelButtons = []; // Empty function now - no level selection }; // Default handler, will be overridden self.onStartGame = function () { console.log("Start game handler not set"); }; return self; }); var MessageBox = Container.expand(function () { var self = Container.call(this); // Create message box background self.background = new Container(); self.addChild(self.background); // Create a semi-transparent black background var bg = LK.getAsset('healthBarBackground', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 0, alpha: 0.8 }); bg.width = 1800; bg.height = 250; self.background.addChild(bg); // Create message text self.messageText = new Text2("", { size: 60, fill: 0xFFFFFF, font: "Impact" }); self.messageText.anchor.set(0.5, 0.5); self.addChild(self.messageText); // Set message function self.setMessage = function (message) { self.messageText.setText(message); }; // Show animation self.show = function () { self.visible = true; self.alpha = 0; tween(self, { alpha: 1 }, { duration: 300 }); }; // Hide animation self.hide = function () { tween(self, { alpha: 0 }, { duration: 300, onFinish: function onFinish() { self.visible = false; } }); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x222222 }); /**** * Game Code ****/ // Setup game state variables var gameState = "menu"; // Can be "menu" or "battle" var battleSystem, battleUI, attackMenu, messageBox; // Create main menu var mainMenu = new MainMenu(); mainMenu.x = 2048 / 2; mainMenu.y = 2732 / 2; game.addChild(mainMenu); // Initialize menu level buttons based on storage data mainMenu.updateLevelButtons(); // Handle starting the game from menu mainMenu.onStartGame = function () { // Hide menu mainMenu.visible = false; // Change state gameState = "battle"; // Create battle elements if they don't exist if (!battleSystem) { // Create main battle system battleSystem = new BattleSystem(); battleSystem.x = 2048 / 2; battleSystem.y = 2732 / 2; game.addChild(battleSystem); // Create UI battleUI = new BattleUI(); battleUI.x = 2048 / 2; battleUI.y = 2732 - 300; game.addChild(battleUI); // Create attack menu initially with null karen parameter attackMenu = new AttackMenu(null); attackMenu.x = 2048 / 2; attackMenu.y = 2732 - 300; game.addChild(attackMenu); // Create message box messageBox = new MessageBox(); messageBox.x = 2048 / 2; messageBox.y = 2732 / 2 - 650; // Position higher above characters game.addChild(messageBox); // Level text removed // Scoreboard removed } else { // Make battle elements visible again battleSystem.visible = true; battleUI.visible = true; attackMenu.visible = false; messageBox.visible = true; } // Karen now uses direct attack buttons // Start the game with appropriate level battleSystem.startBattle(battleSystem.currentLevel); // Start the background music LK.playMusic('battleMusic'); }; // Game update function game.update = function () { // Score system removed };
/****
* 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.executePlayerTurn(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,
font: "Impact"
});
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;
};
// Store original scale values when button is created
self.originalScaleX = self.scale.x;
self.originalScaleY = self.scale.y;
self.down = function (x, y, obj) {
if (!self.enabled) {
return;
}
// Use button graphic scale change instead of the entire container
tween(self.button, {
scaleX: 0.9,
scaleY: 0.9
}, {
duration: 100
});
};
self.up = function (x, y, obj) {
if (!self.enabled) {
return;
}
// Reset button graphic scale instead of the entire container
tween(self.button, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 100
});
if (self.onSelect) {
self.onSelect();
}
};
self.setEnabled(true);
return self;
});
var BattleSystem = Container.expand(function () {
var self = Container.call(this);
// Remove existing background if it exists
if (self.battleBackground) {
self.removeChild(self.battleBackground);
}
// Set background based on current level
if (self.currentLevel === 1 || storage.currentLevel === 1) {
self.battleBackground = self.attachAsset('battleBackground', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 0,
scaleX: 1.2,
scaleY: 1.2
});
} else if (self.currentLevel === 2 || storage.currentLevel === 2) {
self.battleBackground = self.attachAsset('battlebackground2', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 0,
scaleX: 2.0,
scaleY: 1.6
});
} else {
self.battleBackground = self.attachAsset('battlebackground3', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 0,
scaleX: 3.4,
scaleY: 2.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;
// Set current level
self.currentLevel = level;
// Update background for the new level
if (self.battleBackground) {
self.removeChild(self.battleBackground);
}
if (level === 1) {
self.battleBackground = self.attachAsset('battleBackground', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 0,
scaleX: 1.2,
scaleY: 1.2
});
} else if (level === 2) {
self.battleBackground = self.attachAsset('battlebackground2', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 0,
scaleX: 2.0,
scaleY: 1.6
});
} else {
self.battleBackground = self.attachAsset('battlebackground3', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 0,
scaleX: 3.4,
scaleY: 2.0
});
}
self.addChild(self.battleBackground);
// Create karen with level-specific attacks
self.karen = new Karen();
// Update Karen's attacks based on level
if (level === 1) {
self.karen.attacks = [{
name: "Demand Manager",
damage: 20,
description: "Karen demanded to see the manager!"
}, {
name: "I know the owner !!",
damage: 25,
description: "Karen claims to know the owner!"
}, {
name: "Write a 1 star review !",
damage: 30,
description: "Karen threatened a bad review!"
}, {
name: "Your salary",
damage: 35,
description: "Karen threatened about employee's salary!"
}];
} else if (level === 2) {
self.karen.attacks = [{
name: "Call the police",
damage: 20,
description: "Karen threatens to call the police on the kid"
}, {
name: "Talk to parents",
damage: 25,
description: "Karen demands to speak with the kid's parents"
}, {
name: "Faking getting hurt",
damage: 35,
special: true,
description: "Karen pretends to be injured by the kid"
}, {
name: "Private property",
damage: 30,
description: "Karen claims the kid is trespassing on private property"
}];
} else if (level === 3) {
self.karen.attacks = [{
name: "Lawsuit Threat",
damage: 25,
description: "Karen threatens to sue the business"
}, {
name: "I know my rights !!",
damage: 30,
description: "Karen insists she knows her legal rights"
}, {
name: "Unacceptable !!",
damage: 40,
special: true,
description: "Karen screams 'UNACCEPTABLE!' at top volume"
}, {
name: "Social Media Blast",
damage: 35,
description: "Karen threatens to post about this on all platforms"
}];
}
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!");
// Update button texts based on Karen's current attacks
battleUI.attackButton1.text.setText(self.karen.attacks[0].name);
battleUI.attackButton1.attackData = self.karen.attacks[0];
battleUI.attackButton2.text.setText(self.karen.attacks[1].name);
battleUI.attackButton2.attackData = self.karen.attacks[1];
battleUI.attackButton3.text.setText(self.karen.attacks[2].name);
battleUI.attackButton3.attackData = self.karen.attacks[2];
battleUI.attackButton4.text.setText(self.karen.attacks[3].name);
battleUI.attackButton4.attackData = self.karen.attacks[3];
// Wait a moment then show "What will Karen do?"
LK.setTimeout(function () {
battleUI.setMessage("What will Karen do?");
}, 2000);
battleUI.enableButtons(true);
battleUI.showMainMenu();
// Play appropriate sound based on level
if (level === 1) {
LK.getSound('excuseme').play();
} else if (level === 2) {
LK.getSound('whatareyoudoing').play();
}
// Play battle music
LK.playMusic('battleMusic');
};
self.executePlayerTurn = function (attack) {
if (!self.playerTurn || self.gameOver) {
return;
}
// Disable buttons during animation
battleUI.enableButtons(false);
// Show attack message
battleUI.setMessage(attack.name + "! " + (attack.description ? attack.description : ""));
// Play attack sound
LK.getSound('attack').play();
if (attack.name === "Demand Manager") {
LK.getSound('askmanager').play();
} else if (attack.name === "I know the owner !!") {
LK.getSound('knowtheowner').play();
} else if (attack.name === "Write a 1 star review !") {
LK.getSound('writingreview').play();
} else if (attack.name === "Your salary") {
LK.getSound('payyoursalary').play();
} else if (attack.name === "Security Please") {
LK.getSound('securityplease').play();
} else if (attack.name === "Complaint Form") {
LK.getSound('complainform').play();
} else if (attack.name === "Is there a Carin") {
LK.getSound('istherecarin').play();
} else if (attack.name === "Miss Calm Down") {
LK.getSound('misscalmdown').play();
} else if (attack.name === "Faking getting hurt") {
LK.getSound('gettinghurt').play();
} else if (attack.name === "Call the police") {
LK.getSound('police').play();
} else if (attack.name === "Talk to parents") {
LK.getSound('talktoparents').play();
} else if (attack.name === "Private property") {
LK.getSound('privateproperty').play();
} else {
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);
// Removed damage message display
// 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();
}, 3000);
}
}, 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();
}, 3000);
};
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();
if (action.attack.name === "Is there a Carin") {
LK.getSound('istherecarin').play();
} else if (action.attack.name === "Security Please") {
LK.getSound('securityplease').play();
} else if (action.attack.name === "Miss Calm Down") {
LK.getSound('misscalmdown').play();
} else if (action.attack.name === "Complaint Form") {
LK.getSound('complainform').play();
} else if (action.attack.name === "Ignore" || action.attack.name === "Skateboard Trick" || action.attack.name === "Ok Boomer") {
// Kid sounds could be added here if available
} else if (action.attack.name === "Corporate Policy" || action.attack.name === "Security Call" || action.attack.name === "Lifetime Ban" || action.attack.name === "Record Incident") {
// Manager sounds could be added here if available
}
// Deal damage
var damage = action.attack.damage;
var actualDamage = self.karen.takeDamage(damage);
// Removed damage message display
// 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();
}, 3000);
}
} 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();
}, 3000);
}
}, 600);
};
self.enemyDefeated = function () {
self.gameOver = true;
// Show victory message first
battleUI.setMessage(self.currentEnemy.name + " has been defeated!");
// Delay victory sound to avoid overlap with attack sound
LK.setTimeout(function () {
// Play victory sound after delay
LK.getSound('victory').play();
}, 1000);
// Score system removed
LK.setTimeout(function () {
battleUI.setMessage("You won!");
// 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 () {
// Reset to level 1 for next game
self.currentLevel = 1;
storage.currentLevel = 1;
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!");
// Reset to level 1
self.currentLevel = 1;
storage.currentLevel = 1;
// 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,
font: "Impact"
});
self.messageText.anchor.set(0.5, 0);
self.messageText.x = 0;
self.messageText.y = -200;
self.addChild(self.messageText);
// Karen's attack buttons
var karenMoves = [{
name: "Demand Manager",
damage: 20,
defense: 0,
description: "Karen demanded to see the manager!"
}, {
name: "I know the owner !!",
damage: 25,
defense: 0,
description: "Karen claims to know the owner!"
}, {
name: "Write a 1 star review !",
damage: 30,
defense: 0,
description: "Karen threatened a bad review!"
}, {
name: "Your salary",
damage: 35,
defense: 0,
description: "Karen threatened about employee's salary!"
}];
self.attackButton1 = new BattleButton(karenMoves[0].name, -600, -80);
self.attackButton1.attackData = karenMoves[0];
self.attackButton1.scale.set(1.5, 1.5); // Increase button size
self.attackButton1.onSelect = function () {
self.hideMainMenu();
battleSystem.executePlayerTurn(this.attackData);
};
self.addChild(self.attackButton1);
self.attackButton2 = new BattleButton(karenMoves[1].name, -600, 80);
self.attackButton2.attackData = karenMoves[1];
self.attackButton2.scale.set(1.5, 1.5); // Increase button size
self.attackButton2.onSelect = function () {
self.hideMainMenu();
battleSystem.executePlayerTurn(this.attackData);
};
self.addChild(self.attackButton2);
self.attackButton3 = new BattleButton(karenMoves[2].name, 600, -80, 'attackButton');
self.attackButton3.attackData = karenMoves[2];
self.attackButton3.scale.set(1.5, 1.5); // Increase button size
self.attackButton3.onSelect = function () {
self.hideMainMenu();
battleSystem.executePlayerTurn(this.attackData);
};
self.addChild(self.attackButton3);
self.attackButton4 = new BattleButton(karenMoves[3].name, 600, 80, 'attackButton');
self.attackButton4.attackData = karenMoves[3];
self.attackButton4.scale.set(1.5, 1.5); // Increase button size
self.attackButton4.onSelect = function () {
self.hideMainMenu();
battleSystem.executePlayerTurn(this.attackData);
};
self.addChild(self.attackButton4);
self.setMessage = function (message) {
// Use only the message box for displaying messages
if (messageBox) {
messageBox.setMessage(message);
messageBox.show();
}
};
self.enableButtons = function (enabled) {
self.attackButton1.setEnabled(enabled);
self.attackButton2.setEnabled(enabled);
self.attackButton3.setEnabled(enabled);
self.attackButton4.setEnabled(enabled);
};
self.hideMainMenu = function () {
self.attackButton1.visible = false;
self.attackButton2.visible = false;
self.attackButton3.visible = false;
self.attackButton4.visible = false;
};
self.showMainMenu = function () {
self.attackButton1.visible = true;
self.attackButton2.visible = true;
self.attackButton3.visible = true;
self.attackButton4.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.5,
anchorY: 0.5,
x: 0,
y: 300
});
self.addChild(self.healthBarBg);
// Create health bar
self.healthBar = LK.getAsset('healthBar', {
anchorX: 0,
anchorY: 0.5,
x: -200,
y: 300
});
self.addChild(self.healthBar);
// Create health text
self.healthText = new Text2(self.health + "/" + self.maxHealth, {
size: 30,
fill: 0xFFFFFF,
font: "Impact"
});
self.healthText.anchor.set(0.5, 0.5);
self.healthText.x = 0;
self.healthText.y = 300;
self.addChild(self.healthText);
// Create name text
self.nameText = new Text2(self.name, {
size: 40,
fill: 0xFFFFFF,
font: "Impact"
});
self.nameText.anchor.set(0.5, 0.5);
self.nameText.x = 0;
self.nameText.y = 380;
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: "Demand Manager",
damage: 20,
description: "Karen demanded to see the manager!"
}, {
name: "I know the owner !!",
damage: 25,
description: "Karen claims to know the owner!"
}, {
name: "Write a 1 star review !",
damage: 30,
description: "Karen threatened a bad review!"
}, {
name: "Your salary",
damage: 35,
description: "Karen threatened about employee's salary!"
}]);
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", 100, [{
name: "Is there a Carin",
damage: 0,
defense: 15,
description: "Asked if there is another Karen named Carin!"
}, {
name: "Security Please",
damage: 30,
defense: 0,
description: "Called security for assistance!"
}, {
name: "Miss Calm Down",
damage: 15,
defense: 5,
description: "Asked Karen to please calm down..."
}, {
name: "Complaint Form",
damage: 25,
defense: 0,
description: "Offered a formal complaint form to fill."
}]);
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: "Kid ignores Karen completely"
}, {
name: "Skateboard Trick",
damage: 25,
description: "Does a cool skateboard trick in front of Karen"
}, {
name: "Ok Boomer",
damage: 35,
special: true,
description: "Kid says 'OK Boomer' and keeps playing"
}, {
name: "Film For TikTok",
damage: 30,
description: "Starts filming Karen for a viral TikTok"
}]);
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: attack.name + "! " + (attack.description ? attack.description : "")
};
};
return self;
});
var MainMenu = Container.expand(function () {
var self = Container.call(this);
// Add menu background
self.background = self.attachAsset('menubackground', {
anchorX: 0.5,
anchorY: 0.5
});
// Remove title and subtitle text for cleaner look
// Start Button - bigger and lower on screen
self.startButton = new BattleButton("Start Game", 0, 500, 'attackButton');
self.startButton.scale.set(2.0, 2.0); // Make button significantly bigger
self.startButton.onSelect = function () {
self.onStartGame();
};
self.addChild(self.startButton);
// Level select if player has unlocked additional levels
self.levelButtons = [];
self.updateLevelButtons = function () {
// Clear existing buttons
for (var i = 0; i < self.levelButtons.length; i++) {
self.removeChild(self.levelButtons[i]);
}
self.levelButtons = [];
// Empty function now - no level selection
};
// Default handler, will be overridden
self.onStartGame = function () {
console.log("Start game handler not set");
};
return self;
});
var MessageBox = Container.expand(function () {
var self = Container.call(this);
// Create message box background
self.background = new Container();
self.addChild(self.background);
// Create a semi-transparent black background
var bg = LK.getAsset('healthBarBackground', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 0,
alpha: 0.8
});
bg.width = 1800;
bg.height = 250;
self.background.addChild(bg);
// Create message text
self.messageText = new Text2("", {
size: 60,
fill: 0xFFFFFF,
font: "Impact"
});
self.messageText.anchor.set(0.5, 0.5);
self.addChild(self.messageText);
// Set message function
self.setMessage = function (message) {
self.messageText.setText(message);
};
// Show animation
self.show = function () {
self.visible = true;
self.alpha = 0;
tween(self, {
alpha: 1
}, {
duration: 300
});
};
// Hide animation
self.hide = function () {
tween(self, {
alpha: 0
}, {
duration: 300,
onFinish: function onFinish() {
self.visible = false;
}
});
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x222222
});
/****
* Game Code
****/
// Setup game state variables
var gameState = "menu"; // Can be "menu" or "battle"
var battleSystem, battleUI, attackMenu, messageBox;
// Create main menu
var mainMenu = new MainMenu();
mainMenu.x = 2048 / 2;
mainMenu.y = 2732 / 2;
game.addChild(mainMenu);
// Initialize menu level buttons based on storage data
mainMenu.updateLevelButtons();
// Handle starting the game from menu
mainMenu.onStartGame = function () {
// Hide menu
mainMenu.visible = false;
// Change state
gameState = "battle";
// Create battle elements if they don't exist
if (!battleSystem) {
// Create main battle system
battleSystem = new BattleSystem();
battleSystem.x = 2048 / 2;
battleSystem.y = 2732 / 2;
game.addChild(battleSystem);
// Create UI
battleUI = new BattleUI();
battleUI.x = 2048 / 2;
battleUI.y = 2732 - 300;
game.addChild(battleUI);
// Create attack menu initially with null karen parameter
attackMenu = new AttackMenu(null);
attackMenu.x = 2048 / 2;
attackMenu.y = 2732 - 300;
game.addChild(attackMenu);
// Create message box
messageBox = new MessageBox();
messageBox.x = 2048 / 2;
messageBox.y = 2732 / 2 - 650; // Position higher above characters
game.addChild(messageBox);
// Level text removed
// Scoreboard removed
} else {
// Make battle elements visible again
battleSystem.visible = true;
battleUI.visible = true;
attackMenu.visible = false;
messageBox.visible = true;
}
// Karen now uses direct attack buttons
// Start the game with appropriate level
battleSystem.startBattle(battleSystem.currentLevel);
// Start the background music
LK.playMusic('battleMusic');
};
// Game update function
game.update = function () {
// Score system removed
};
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