User prompt
Please fix the bug: 'Uncaught ReferenceError: displayAetherFurnacePopup is not defined' in or related to this line: 'var forgeNodes = [{' Line Number: 474
User prompt
Please fix the bug: 'Uncaught ReferenceError: displayAdaptiveCraftingPopup is not defined' in or related to this line: 'var forgeNodes = [{' Line Number: 474
User prompt
Please fix the bug: 'Uncaught ReferenceError: displayRunicHammerPopup is not defined' in or related to this line: 'var forgeNodes = [{' Line Number: 474
User prompt
Please fix the bug: 'Uncaught ReferenceError: displayArcaneAlloyPopup is not defined' in or related to this line: 'var forgeNodes = [{' Line Number: 468
User prompt
Please fix the bug: 'Uncaught ReferenceError: displayMetalMasteryPopup is not defined' in or related to this line: 'var forgeNodes = [{' Line Number: 462
User prompt
Please fix the bug: 'Uncaught ReferenceError: displayForgeFirePopup is not defined' in or related to this line: 'var forgeNodes = [{' Line Number: 456
User prompt
Please fix the bug: 'Uncaught ReferenceError: displayLegendaryAncestorPopup is not defined' in or related to this line: 'var ancestryNodes = [{' Line Number: 406
User prompt
Please fix the bug: 'Uncaught ReferenceError: displaySpiritGuidancePopup is not defined' in or related to this line: 'var ancestryNodes = [{' Line Number: 400
User prompt
Please fix the bug: 'Uncaught ReferenceError: displayHerbalRemediesPopup is not defined' in or related to this line: 'var ancestryNodes = [{' Line Number: 394
User prompt
Please fix the bug: 'Uncaught ReferenceError: displayBeastTamerPopup is not defined' in or related to this line: 'var ancestryNodes = [{' Line Number: 388
User prompt
Please fix the bug: 'Uncaught ReferenceError: displayWarriorSpiritPopup is not defined' in or related to this line: 'var ancestryNodes = [{' Line Number: 388
User prompt
Please fix the bug: 'Uncaught ReferenceError: displayElementalMasteryPopup is not defined' in or related to this line: 'var ancestryNodes = [{' Line Number: 388
User prompt
Please fix the bug: 'Uncaught ReferenceError: displayAncientWisdomPopup is not defined' in or related to this line: 'var ancestryNodes = [{' Line Number: 388
User prompt
Please fix the bug: 'Uncaught ReferenceError: circuitNodes is not defined' in or related to this line: 'chosenNodes = circuitNodes;' Line Number: 978
User prompt
function openSkillTreePopup(skillTreeName) { menuContainer.removeChild(skillTreePopup); var newPopup = new Container(); newPopup.width = 2048; newPopup.height = 2732; newPopup.x = 0; newPopup.y = 0; var newPopupBackground = LK.getAsset('skillTree_Background', { anchorX: 0.5, anchorY: 0.5 }); newPopupBackground.x = 2048 / 2; newPopupBackground.y = 2732 / 2; newPopup.addChild(newPopupBackground); // Create a back button for all trees var backButton = new BackButton(); newPopup.addChild(backButton); // Define a helper function to add skill nodes function addSkillNodes(nodes) { nodes.forEach(function (node) { var skillNode = LK.getAsset(node.id, { anchorX: 0.5, anchorY: 0.5 }); skillNode.x = node.x; skillNode.y = node.y; skillNode.down = function () { if (isDataSpikePopupActive) { return; // If a skill popup is already active, do nothing } // Call the popup function associated with this node node.action(); isDataSpikePopupActive = true; // Highlight node briefly var originalColor = skillNode.tint; skillNode.tint = 0xffff00; LK.setTimeout(function () { skillNode.tint = originalColor; }, 1000); }; newPopup.addChild(skillNode); }); } // Define the skill nodes for each tree here. // For each skill tree, we use the same layout as Circuit of Ascension (7 skills arranged similarly). // We must provide icons and display functions for each skill. // Reuse the layout positions from the original code: // Tier 1: 3 skills at (2048/4, 2048/2, 3*2048/4, y = 2732/6) // Tier 2: 3 skills at the same x positions but y = 2*2732/6 // Tier 3: 1 skill at 2048/2, y = 3*2732/6 (ultimate skill) // // Example icons: 'data_spike_icon', 'reflex_accelerator_icon', etc. // You'll need to create corresponding displayXPopup functions for each unique skill. var baseXPositions = [2048/4, 2048/2, 3*2048/4]; var tier1Y = 2732/6; var tier2Y = 2*2732/6; var tier3Y = 3*2732/6; // Circuit of Ascension skill nodes (already defined in your code) var circuitNodes = [ {id:'data_spike_icon', x:baseXPositions[0], y:tier1Y, name:'Data Spike', action:displayDataSpikePopup}, {id:'reflex_accelerator_icon', x:baseXPositions[1], y:tier1Y, name:'Reflex Accelerator', action:displayReflexAcceleratorPopup}, {id:'overclock_core_icon', x:baseXPositions[2], y:tier1Y, name:'Overclock Core', action:displayOverclockCorePopup}, {id:'neural_hijack_icon', x:baseXPositions[0], y:tier2Y, name:'Neural Hijack', action:displayNeuralHijackPopup}, {id:'dodge_matrix_icon', x:baseXPositions[1], y:tier2Y, name:'Dodge Matrix', action:displayDodgeMatrixPopup}, {id:'brown_node_icon', x:baseXPositions[2], y:tier2Y, name:'Power Surge', action:displayPowerSurgePopup}, {id:'ultimate_skill_icon', x:2048/2, y:tier3Y, name:'Overload Blast', action:displayOverloadBlastPopup} ]; // Echoes of Ancestry skill nodes (new set) // You'll need to define display functions for these skills: // displayAncientWisdomPopup, displayElementalMasteryPopup, etc. var ancestryNodes = [ {id:'data_spike_icon', x:baseXPositions[0], y:tier1Y, name:'Ancient Wisdom', action:displayAncientWisdomPopup}, {id:'reflex_accelerator_icon', x:baseXPositions[1], y:tier1Y, name:'Elemental Mastery', action:displayElementalMasteryPopup}, {id:'overclock_core_icon', x:baseXPositions[2], y:tier1Y, name:'Warrior Spirit', action:displayWarriorSpiritPopup}, {id:'neural_hijack_icon', x:baseXPositions[0], y:tier2Y, name:'Beast Tamer', action:displayBeastTamerPopup}, {id:'dodge_matrix_icon', x:baseXPositions[1], y:tier2Y, name:'Herbal Remedies', action:displayHerbalRemediesPopup}, {id:'brown_node_icon', x:baseXPositions[2], y:tier2Y, name:'Spirit Guidance', action:displaySpiritGuidancePopup}, {id:'ultimate_skill_icon', x:2048/2, y:tier3Y, name:'Legendary Ancestor', action:displayLegendaryAncestorPopup} ]; // Forge of Possibilities skill nodes (example) var forgeNodes = [ {id:'data_spike_icon', x:baseXPositions[0], y:tier1Y, name:'Forge Fire', action:displayForgeFirePopup}, {id:'reflex_accelerator_icon', x:baseXPositions[1], y:tier1Y, name:'Metal Mastery', action:displayMetalMasteryPopup}, {id:'overclock_core_icon', x:baseXPositions[2], y:tier1Y, name:'Arcane Alloy', action:displayArcaneAlloyPopup}, {id:'neural_hijack_icon', x:baseXPositions[0], y:tier2Y, name:'Runic Hammer', action:displayRunicHammerPopup}, {id:'dodge_matrix_icon', x:baseXPositions[1], y:tier2Y, name:'Adaptive Crafting', action:displayAdaptiveCraftingPopup}, {id:'brown_node_icon', x:baseXPositions[2], y:tier2Y, name:'Aether Furnace', action:displayAetherFurnacePopup}, {id:'ultimate_skill_icon', x:2048/2, y:tier3Y, name:'Godforge', action:displayGodforgePopup} ]; // Prism of Potential skill nodes (example) var prismNodes = [ {id:'data_spike_icon', x:baseXPositions[0], y:tier1Y, name:'Red Fury', action:displayRedFuryPopup}, {id:'reflex_accelerator_icon', x:baseXPositions[1], y:tier1Y, name:'Blue Shield', action:displayBlueShieldPopup}, {id:'overclock_core_icon', x:baseXPositions[2], y:tier1Y, name:'Green Speed', action:displayGreenSpeedPopup}, {id:'neural_hijack_icon', x:baseXPositions[0], y:tier2Y, name:'Yellow Insight', action:displayYellowInsightPopup}, {id:'dodge_matrix_icon', x:baseXPositions[1], y:tier2Y, name:'Purple Stealth', action:displayPurpleStealthPopup}, {id:'brown_node_icon', x:baseXPositions[2], y:tier2Y, name:'Orange Rage', action:displayOrangeRagePopup}, {id:'ultimate_skill_icon', x:2048/2, y:tier3Y, name:'White Nova', action:displayWhiteNovaPopup} ]; // Nexus of Chaos skill nodes (example) var nexusNodes = [ {id:'data_spike_icon', x:baseXPositions[0], y:tier1Y, name:'Chaotic Bolt', action:displayChaoticBoltPopup}, {id:'reflex_accelerator_icon', x:baseXPositions[1], y:tier1Y, name:'Entropy Field', action:displayEntropyFieldPopup}, {id:'overclock_core_icon', x:baseXPositions[2], y:tier1Y, name:'Random Surge', action:displayRandomSurgePopup}, {id:'neural_hijack_icon', x:baseXPositions[0], y:tier2Y, name:'Void Pull', action:displayVoidPullPopup}, {id:'dodge_matrix_icon', x:baseXPositions[1], y:tier2Y, name:'Fractal Shield', action:displayFractalShieldPopup}, {id:'brown_node_icon', x:baseXPositions[2], y:tier2Y, name:'Quantum Blink', action:displayQuantumBlinkPopup}, {id:'ultimate_skill_icon', x:2048/2, y:tier3Y, name:'Cosmic Collapse', action:displayCosmicCollapsePopup} ]; // Symphony of Shadows skill nodes (example) var symphonyNodes = [ {id:'data_spike_icon', x:baseXPositions[0], y:tier1Y, name:'Shadow Blade', action:displayShadowBladePopup}, {id:'reflex_accelerator_icon', x:baseXPositions[1], y:tier1Y, name:'Silent Step', action:displaySilentStepPopup}, {id:'overclock_core_icon', x:baseXPositions[2], y:tier1Y, name:'Umbral Strike', action:displayUmbralStrikePopup}, {id:'neural_hijack_icon', x:baseXPositions[0], y:tier2Y, name:'Nightmare Veil', action:displayNightmareVeilPopup}, {id:'dodge_matrix_icon', x:baseXPositions[1], y:tier2Y, name:'Echoing Laugh', action:displayEchoingLaughPopup}, {id:'brown_node_icon', x:baseXPositions[2], y:tier2Y, name:'Phantom Waltz', action:displayPhantomWaltzPopup}, {id:'ultimate_skill_icon', x:2048/2, y:tier3Y, name:'Final Crescendo', action:displayFinalCrescendoPopup} ]; // Based on the skillTreeName, choose the node array var chosenNodes; if (skillTreeName === 'The Circuit of Ascension') { chosenNodes = circuitNodes; } else if (skillTreeName === 'The Echoes of Ancestry') { chosenNodes = ancestryNodes; } else if (skillTreeName === 'The Forge of Possibilities') { chosenNodes = forgeNodes; } else if (skillTreeName === 'The Prism of Potential') { chosenNodes = prismNodes; } else if (skillTreeName === 'The Nexus of Chaos') { chosenNodes = nexusNodes; } else if (skillTreeName === 'The Symphony of Shadows') { chosenNodes = symphonyNodes; } // Add the chosen skill nodes to the popup addSkillNodes(chosenNodes); var skillTreeTitle = new Text2(skillTreeName, { size: 150, fill: "#ffffff", fontWeight: "bold", fontFamily: "Techno, sans-serif", letterSpacing: 2, stroke: "#00ffcc", strokeThickness: 3 }); skillTreeTitle.x = 2048 / 2; skillTreeTitle.y = 100; skillTreeTitle.anchor.set(0.5, 0); newPopup.addChild(skillTreeTitle); // Create the skillTreePointsText at the bottom of the skill tree popup skillTreePointsText = new Text2('Skill Points: ' + heroSkillPoints, { size: 70, fill: "#ffffff", fontWeight: "bold" }); skillTreePointsText.x = 2048 / 2; skillTreePointsText.y = 2732 - 100; // bottom of the screen skillTreePointsText.anchor.set(0.5, 0); newPopup.addChild(skillTreePointsText); // Update skill points display refreshTreePointsText(); menuContainer.addChild(newPopup); }
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'addChild')' in or related to this line: 'uiContainer.addChild(openSkillTreeButton);' Line Number: 341
User prompt
Please fix the bug: 'Uncaught ReferenceError: menuContainer is not defined' in or related to this line: 'menuContainer.addChild(skillTreePopup);' Line Number: 528
User prompt
Please fix the bug: 'Uncaught ReferenceError: uiContainer is not defined' in or related to this line: 'uiContainer.addChild(openSkillTreeButton);' Line Number: 344
User prompt
Duplicate/Re-Defined Variables and Containers In the code snippet, var gameContainer = new Container(); var uiContainer = new Container(); var menuContainer = new Container(); are defined multiple times at different points. This causes the original references to be lost and can lead to undefined behavior. Containers like gameContainer, uiContainer, and menuContainer should only be defined once, typically near the start of your code, and added to the game once: var gameContainer = new Container(); var uiContainer = new Container(); var menuContainer = new Container(); game.addChild(gameContainer); game.addChild(uiContainer); game.addChild(menuContainer); Make sure you do this only once. If you redefine them later, you’ll wipe out any children you previously added to them. Ensure uiContainer Exists Before Adding Buttons You have code like: uiContainer.addChild(openSkillTreeButton); Make sure that uiContainer is defined and added to the game before you create and add openSkillTreeButton. If you define uiContainer further down again, it’ll overwrite the reference and openSkillTreeButton will end up not actually being on the screen. Confirm that: uiContainer is defined once at the start. uiContainer.addChild(openSkillTreeButton); is done after that single definition, not before or in between multiple redefinitions. Remove Redundant or Conflicting Variable Declarations Scan through the code and remove any extra sets of var gameContainer = new Container();, var uiContainer = new Container();, and var menuContainer = new Container(); beyond the first one. Also ensure variables like hero, arrows, currentRoom, etc. are only declared once. Re-declaring them multiple times can cause confusion and unexpected states.
User prompt
verify that isPopupActive is set to false after closing the skill tree
User prompt
Create openSkillTreeButton After uiContainer is Defined: Make sure you define openSkillTreeButton after uiContainer is ready. For example: javascript Copy code // Ensure uiContainer is defined above var openSkillTreeButton = LK.getAsset('attackIcon', { anchorX: 0.5, anchorY: 0.5 }); // Place it somewhere on the screen openSkillTreeButton.x = 200; openSkillTreeButton.y = 200; // Now uiContainer is defined, so we can add the button uiContainer.addChild(openSkillTreeButton); Check for Typos or Scope Issues: Sometimes, a simple typo can cause uiContainer to be undefined. Ensure you're not misspelling uiContainer anywhere and that the code that references uiContainer is not inside a function or block that doesn't have access to that variable. Confirm openSkillTreeButton is Created Properly: Make sure openSkillTreeButton is not null or undefined. If the asset ID 'attackIcon' doesn’t exist or fails to load, it might not return a proper object. Double-check the asset name.
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'addChild')' in or related to this line: 'uiContainer.addChild(openSkillTreeButton);' Line Number: 341
User prompt
Ensure uiContainer is Defined Before Use: Make sure uiContainer is defined and added to the game before you add the openSkillTreeButton. For example: // Define these variables at the top of your code var gameContainer = new Container(); var uiContainer = new Container(); var menuContainer = new Container(); game.addChild(gameContainer); game.addChild(uiContainer); game.addChild(menuContainer);
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'addChild')' in or related to this line: 'uiContainer.addChild(openSkillTreeButton);' Line Number: 341
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'addChild')' in or related to this line: 'uiContainer.addChild(openSkillTreeButton);' Line Number: 341
/****
* Classes
****/
// Arrow class representing the arrows fired by the hero
var Arrow = Container.expand(function () {
var self = Container.call(this);
self.attachAsset('arrow', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 15;
self.damage = 5;
self.update = function () {
self.x += Math.cos(self.rotation) * self.speed;
self.y += Math.sin(self.rotation) * self.speed;
if (self.x < 0 || self.x > 2048 || self.y < 0 || self.y > 2732) {
self.destroy();
}
};
});
// BackButton class representing the back button functionality
var BackButton = Container.expand(function () {
var self = Container.call(this);
self.attachAsset('backButton', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 2,
scaleY: 2
});
self.x = 150;
self.y = 350;
self.down = function () {
menuContainer.removeChild(self.parent);
menuContainer.addChild(skillTreePopup);
};
return self;
});
// Enemy class representing the enemy character
var Enemy = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.attachAsset('enemy_run1', {
anchorX: 0.5,
anchorY: 0.5
});
var frames = [LK.getAsset('enemy_run1', {
anchorX: 0.5,
anchorY: 0.5
}), LK.getAsset('enemy_run2', {
anchorX: 0.5,
anchorY: 0.5
}), LK.getAsset('enemy_run3', {
anchorX: 0.5,
anchorY: 0.5
}), LK.getAsset('enemy_run4', {
anchorX: 0.5,
anchorY: 0.5
})];
self.speed = 2 + Math.random() * 0.5;
self.damageCooldown = 0;
var currentFrame = 0;
var frameDelay = 30;
var frameCounter = 0;
self.update = function () {
frameCounter++;
if (frameCounter >= frameDelay) {
frameCounter = 0;
self.removeChild(enemyGraphics);
currentFrame = (currentFrame + 1) % frames.length;
enemyGraphics = self.addChild(frames[currentFrame]);
}
var offsetX = (Math.random() - 0.5) * 20;
var offsetY = (Math.random() - 0.5) * 20;
var dx = hero.x + offsetX - self.x;
var dy = hero.y + offsetY - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
var minDistance = 70;
if (distance > minDistance) {
self.x += dx / distance * self.speed;
self.y += dy / distance * self.speed;
self.rotation = Math.atan2(dy, dx);
} else {
if (self.damageCooldown <= 0) {
hero.health -= 5;
self.damageCooldown = 60;
updateRoomDisplay();
} else {
self.damageCooldown--;
}
self.x -= dx / distance * (minDistance - distance);
self.y -= dy / distance * (minDistance - distance);
}
if (self.x < wallThickness) {
self.x = wallThickness;
}
if (self.x > roomWidth - wallThickness) {
self.x = roomWidth - wallThickness;
}
if (self.y < wallThickness) {
self.y = wallThickness;
}
if (self.y > roomHeight - wallThickness) {
self.y = roomHeight - wallThickness;
}
};
return self;
});
// Hero class representing the player character
var Hero = Container.expand(function () {
var self = Container.call(this);
var heroGraphics = self.attachAsset('hero', {
anchorX: 0.5,
anchorY: 0.5
});
self.swordGraphics = heroGraphics.addChild(LK.getAsset('sword', {
anchorX: 0.5,
anchorY: 0.5
}));
self.swordGraphics.x = heroGraphics.width / 2 + 20;
self.swordGraphics.y = 0;
self.bowGraphics = self.attachAsset('bow', {
anchorX: 0.5,
anchorY: 0.5
});
self.bowGraphics.x = heroGraphics.width / 2;
self.bowGraphics.visible = false;
self.attackCooldown = 0;
self.isAttacking = false;
self.health = 100;
self.attackDuration = 20;
self.weaponType = 1;
self.attackRange = 60;
self.attackDamage = 10;
self.speed = 3;
self.joystick = null;
self.update = function () {
var direction = this.joystick ? this.joystick.getDirection() : {
x: 0,
y: 0
};
var nextX = this.x + direction.x * this.speed;
var nextY = this.y + direction.y * this.speed;
if (nextX < wallThickness && !(nextY >= entrances.left.yStart && nextY <= entrances.left.yEnd)) {
nextX = wallThickness;
} else if (nextX > roomWidth - wallThickness && !(nextY >= entrances.right.yStart && nextY <= entrances.right.yEnd)) {
nextX = roomWidth - wallThickness;
}
if (nextY < wallThickness && !(nextX >= entrances.top.xStart && nextX <= entrances.top.xEnd)) {
nextY = wallThickness;
} else if (nextY > roomHeight - wallThickness && !(nextX >= entrances.bottom.xStart && nextX <= entrances.bottom.xEnd)) {
nextY = roomHeight - wallThickness;
}
this.x = nextX;
this.y = nextY;
if (self.isAttacking) {
var swingProgress = (self.attackDuration - self.attackCooldown) / self.attackDuration;
self.swordGraphics.rotation = Math.sin(swingProgress * Math.PI) * 1.2;
self.swordGraphics.x = heroGraphics.width / 2 + Math.cos(swingProgress * Math.PI) * 30;
self.swordGraphics.y = Math.sin(swingProgress * Math.PI) * 30;
self.attackCooldown--;
if (self.attackCooldown <= 0) {
self.isAttacking = false;
self.swordGraphics.rotation = 0;
} else {
for (var i = currentRoom.enemies.length - 1; i >= 0; i--) {
var enemy = currentRoom.enemies[i];
var angleToEnemy = Math.atan2(enemy.y - self.y, enemy.x - self.x);
var angleDifference = Math.abs(angleToEnemy - self.rotation);
var swordDx = enemy.x - (self.x + Math.cos(self.rotation) * self.attackRange);
var swordDy = enemy.y - (self.y + Math.sin(self.rotation) * self.attackRange);
var swordDistance = Math.sqrt(swordDx * swordDx + swordDy * swordDy);
if (swordDistance < self.attackRange && angleDifference < Math.PI / 4) {
enemy.health -= self.attackDamage;
if (enemy.health <= 0) {
currentRoom.enemiesKilled++;
currentRoom.enemyCounter--;
enemy.destroy();
currentRoom.enemies.splice(i, 1);
updateRoomDisplay();
}
}
}
}
} else {
self.swordGraphics.rotation = 0;
}
};
});
// Joystick class representing the on-screen joystick for movement
var Joystick = Container.expand(function () {
var self = Container.call(this);
var joystickBackground = self.attachAsset('joystickBackground', {
anchorX: 0.5,
anchorY: 0.5
});
var joystickHandle = self.attachAsset('joystickHandle', {
anchorX: 0.5,
anchorY: 0.5
});
self.x = joystickBackground.width / 2 + 100;
self.y = 2732 - joystickBackground.height / 2 - 100;
var maxRadius = 100;
var isDragging = false;
self.down = function (x, y, obj) {
isDragging = true;
};
self.move = function (x, y, obj) {
if (isDragging && !isPopupActive) {
var localPos = self.toLocal(obj.global);
var dx = localPos.x;
var dy = localPos.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > maxRadius) {
var angle = Math.atan2(dy, dx);
dx = maxRadius * Math.cos(angle);
dy = maxRadius * Math.sin(angle);
}
joystickHandle.x = dx;
joystickHandle.y = dy;
}
};
self.up = function (x, y, obj) {
isDragging = false;
joystickHandle.x = 0;
joystickHandle.y = 0;
};
self.getDirection = function () {
var magnitude = Math.sqrt(joystickHandle.x * joystickHandle.x + joystickHandle.y * joystickHandle.y);
if (magnitude > 0) {
return {
x: joystickHandle.x / magnitude,
y: joystickHandle.y / magnitude
};
}
return {
x: 0,
y: 0
};
};
return self;
});
// StartGameButton class representing the start game button functionality
var StartGameButton = Container.expand(function () {
var self = Container.call(this);
self.attachAsset('startGameButton', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 3,
scaleY: 3
});
self.x = 2048 / 2;
self.y = 2732 - 400;
self.down = function () {
menuContainer.removeChild(skillTreePopup);
// If the game hasn't started yet, start it, else resume it
if (!gameStarted) {
// Starting the game for the first time
gameStarted = true;
initializeGame();
LK.playMusic('room1_music', {
loop: true
});
} else {
// Resuming the game if it was paused
gamePaused = false;
isPopupActive = false;
isDataSpikePopupActive = false;
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000
});
/****
* Game Code
****/
var openSkillTreeButton = LK.getAsset('attackIcon', {
anchorX: 0.5,
anchorY: 0.5
});
// Place it somewhere on the screen, for example top-left corner
openSkillTreeButton.x = 200;
openSkillTreeButton.y = 200;
uiContainer.addChild(openSkillTreeButton);
openSkillTreeButton.down = function (x, y, obj) {
if (!isPopupActive && gameStarted) {
// Open the skillTreePopup again
menuContainer.addChild(skillTreePopup);
isPopupActive = true;
gamePaused = true; // Pause the game when skill tree is opened during gameplay
}
};
function updateSkillPointsDisplay() {
if (typeof skillPointsDisplay !== 'undefined') {
skillPointsDisplay.setText('Skill Points: ' + heroSkillPoints);
}
if (typeof skillPointsText !== 'undefined') {
skillPointsText.setText('Skill Points: ' + heroSkillPoints);
}
}
updateSkillPointsDisplay(); // call once to set initial text
// Global variables
var heroSkillPoints = 3; // Starting skill points
var skillTreePointsText = null; // For displaying skill points
var gamePaused = false; // Track if the game is paused
var gameStarted = false; // Track if the game has started or not
// Define refreshTreePointsText globally so it's accessible everywhere
function refreshTreePointsText() {
if (skillTreePointsText) {
skillTreePointsText.setText('Skill Points: ' + heroSkillPoints);
}
}
var roomBackgroundImages = ['backgroundImage1', 'backgroundImage2', 'backgroundImage3', 'backgroundImage4', 'backgroundImage5'];
var arrows = [];
var currentRoom;
var currentRoomMusic;
var hero;
var isPopupActive = false;
var isDataSpikePopupActive = false;
var roomWidth = 2048;
var roomHeight = 2732;
var wallThickness = 400;
var entranceWidth = 200;
var entrances = {
top: {
xStart: (roomWidth - entranceWidth) / 2,
xEnd: (roomWidth + entranceWidth) / 2,
y: wallThickness
},
bottom: {
xStart: (roomWidth - entranceWidth) / 2,
xEnd: (roomWidth + entranceWidth) / 2,
y: roomHeight - wallThickness
},
left: {
yStart: (roomHeight - entranceWidth) / 2,
yEnd: (roomHeight + entranceWidth) / 2,
x: wallThickness
},
right: {
yStart: (roomHeight - entranceWidth) / 2,
yEnd: (roomHeight + entranceWidth) / 2,
x: roomWidth - wallThickness
}
};
var spawnPoints = {
topLeft: {
x: wallThickness,
y: wallThickness
},
topRight: {
x: roomWidth - wallThickness,
y: wallThickness
},
bottomLeft: {
x: wallThickness,
y: roomHeight - wallThickness
},
bottomRight: {
x: roomWidth - wallThickness,
y: roomHeight - wallThickness
}
};
var gameContainer = new Container();
var uiContainer = new Container();
game.addChild(uiContainer);
var menuContainer = new Container();
game.addChild(gameContainer);
game.addChild(uiContainer);
game.addChild(menuContainer);
var skillTreePopup = new Container();
skillTreePopup.width = 2048;
skillTreePopup.height = 2732;
skillTreePopup.x = 0;
skillTreePopup.y = 0;
var skillTreeBackground = LK.getAsset('skillTree_Background', {
anchorX: 0.5,
anchorY: 0.5
});
skillTreeBackground.x = 2048 / 2;
skillTreeBackground.y = 2732 / 2;
skillTreePopup.addChild(skillTreeBackground);
// Add skill points display
var skillPointsDisplay = new Text2('Skill Points: ' + heroSkillPoints, {
size: 70,
fill: "#ffffff",
fontWeight: "bold"
});
skillPointsDisplay.x = 2048 / 2; // center horizontally
skillPointsDisplay.y = 2732 - 100; // near bottom
skillPointsDisplay.anchor.set(0.5, 0);
skillTreePopup.addChild(skillPointsDisplay);
var skillTrees = [{
title: 'The Circuit of Ascension',
theme: 'Futuristic, cybernetic evolution'
}, {
title: 'The Echoes of Ancestry',
theme: 'Mystical and historical'
}, {
title: 'The Forge of Possibilities',
theme: 'Creative and modular'
}, {
title: 'The Prism of Potential',
theme: 'Magical and elemental'
}, {
title: 'The Nexus of Chaos',
theme: 'Unpredictable and chaotic'
}, {
title: 'The Symphony of Shadows',
theme: 'Dark and stealth-focused'
}];
var positions = [{
x: 1024 - 300,
y: 1266 - 400
}, {
x: 1024 + 300,
y: 1266 - 400
}, {
x: 1024 - 300,
y: 1266 - 50
}, {
x: 1024 + 300,
y: 1266 - 50
}, {
x: 1024 - 300,
y: 1266 + 300
}, {
x: 1024 + 300,
y: 1266 + 300
}];
var skillTreeAssetMap = {
'The Circuit of Ascension': 'circuitofascension',
'The Echoes of Ancestry': 'echoesofancestry',
'The Forge of Possibilities': 'forgeofpossibilities',
'The Prism of Potential': 'prismofpotential',
'The Nexus of Chaos': 'nexusofchaos',
'The Symphony of Shadows': 'symphonyofshadows'
};
positions.forEach(function (position, index) {
var skillTree = skillTrees[index];
var titleText = new Text2(skillTree.title, {
size: 50,
fill: "#ffffff",
fontWeight: "bold",
fontFamily: "Techno, sans-serif",
letterSpacing: 2,
stroke: "#00ffcc",
strokeThickness: 3
});
titleText.x = position.x;
titleText.y = position.y + 100;
titleText.anchor.set(0.5, 0);
var skillTreeAssetId = skillTreeAssetMap[skillTree.title];
var skillTreeAsset = LK.getAsset(skillTreeAssetId, {
anchorX: 0.5,
anchorY: 0.5
});
if (!skillTreePopup.children.includes(skillTreeAsset)) {
skillTreePopup.addChild(skillTreeAsset);
}
skillTreeAsset.x = position.x;
skillTreeAsset.y = position.y;
if (!skillTreePopup.children.includes(skillTreeAsset)) {
skillTreePopup.addChild(skillTreeAsset);
}
titleText.down = function () {
openSkillTreePopup(skillTree.title);
};
skillTreePopup.addChild(titleText);
});
isPopupActive = true;
menuContainer.addChild(skillTreePopup);
var testRectangle = LK.getAsset('box', {
anchorX: 0.5,
anchorY: 0.5,
width: 100,
height: 50,
color: 0xff0000
});
testRectangle.x = 100;
testRectangle.y = 100;
skillTreePopup.addChild(testRectangle);
var startGameButton = new StartGameButton();
skillTreePopup.addChild(startGameButton);
function initializeGame() {
currentRoom = new Room(1);
hero.x = 2048 / 2;
hero.y = 2732 / 2;
updateRoomDisplay();
playRoomMusic(currentRoom.number);
}
// Room class representing individual rooms
var Room = function Room(number) {
this.number = number;
this.enemies = [];
this.isCleared = false;
this.spawnLimit = this.number === 1 ? 24 : 12 * this.number;
this.killGoal = this.spawnLimit;
this.enemiesSpawned = 0;
this.enemiesKilled = 0;
this.enemyCounter = this.spawnLimit;
this.init = function () {
var self = this;
var spawnInterval = LK.setInterval(function () {
if (self.enemiesSpawned < self.spawnLimit && currentRoom.number === self.number && !isPopupActive) {
self.spawnEnemy();
} else {
LK.clearInterval(spawnInterval);
}
}, 500);
};
this.spawnEnemy = function () {
if (this.enemiesSpawned < this.spawnLimit && !isPopupActive && currentRoom.number === this.number) {
var spawnKeys = Object.keys(spawnPoints);
var spawnIndex = Math.floor(Math.random() * spawnKeys.length);
var spawnPoint = spawnPoints[spawnKeys[spawnIndex]];
var enemy = new Enemy();
enemy.x = spawnPoint.x;
enemy.y = spawnPoint.y;
enemy.active = true;
enemy.health = 10;
enemy.visible = true;
this.enemies.push(enemy);
game.addChild(enemy);
this.enemiesSpawned++;
}
};
this.init();
};
var initialBgImage = LK.getAsset('backgroundImage1', {
anchorX: 0.5,
anchorY: 0.5
});
initialBgImage.x = 2048 / 2;
initialBgImage.y = 2732 / 2;
game.addChildAt(initialBgImage, 0);
game.background = initialBgImage;
var statsBar = LK.getAsset('box', {
anchorX: 0.0,
anchorY: 0.0,
width: 2048,
height: 100,
x: 0,
y: 0
});
game.addChild(statsBar);
var roomDisplay = new Text2('Room: 1 | Enemies Left: 0', {
size: 70,
fill: "#ffffff",
fontWeight: "bold"
});
roomDisplay.x = 1000;
roomDisplay.y = 20;
game.addChild(roomDisplay);
function updateRoomDisplay() {
var enemiesLeft = currentRoom.spawnLimit - currentRoom.enemiesKilled;
roomDisplay.setText('Room: ' + currentRoom.number + ' | Enemies Left: ' + Math.max(enemiesLeft, 0));
healthText.setText('Health: ' + hero.health);
}
function stopRoomMusic() {
if (currentRoomMusic) {
currentRoomMusic.stop();
}
}
function playRoomMusic(roomNumber) {
if (currentRoomMusic) {
currentRoomMusic.stop();
}
switch (roomNumber) {
case 1:
currentRoomMusic = LK.getSound('room1_music');
currentRoomMusic.play({
loop: true
});
break;
case 2:
LK.playMusic('room2_music', {
loop: true
});
break;
case 3:
LK.playMusic('room3_music', {
loop: true
});
break;
case 4:
currentRoomMusic = LK.getSound('room4_music');
currentRoomMusic.play({
loop: true
});
break;
case 5:
LK.playMusic('room5_music', {
loop: true
});
break;
default:
currentRoomMusic = null;
}
}
function checkRoomCleared() {
if (currentRoom.enemiesKilled >= currentRoom.killGoal && !currentRoom.isCleared) {
var roomClearedSound = LK.getSound('room' + currentRoom.number + '_cleared');
if (roomClearedSound) {
roomClearedSound.play();
}
if (currentRoom.number === 1) {
LK.getSound('room1_music').stop();
} else if (currentRoom.number === 2) {
LK.getSound('room2_music').stop();
} else if (currentRoom.number === 3) {
LK.getSound('room3_music').stop();
} else if (currentRoom.number === 4) {
currentRoomMusic.stop();
} else if (currentRoom.number === 5) {
currentRoomMusic.stop();
}
stopRoomMusic();
currentRoom.isCleared = true;
hero.canExitRoom = true;
updateRoomDisplay();
}
}
function transitionToNextRoom() {
playRoomMusic(currentRoom.number);
if (game.background) {
game.removeChild(game.background);
}
currentRoom.enemies.forEach(function (enemy) {
enemy.destroy();
});
currentRoom.enemies = [];
currentRoom.enemiesSpawned = 0;
currentRoom.enemyCounter = currentRoom.spawnLimit;
currentRoom.enemiesKilled = 0;
currentRoom = new Room(currentRoom.number + 1);
currentRoom.enemiesKilled = 0;
var bgImageIndex = (currentRoom.number - 1) % roomBackgroundImages.length;
var bgImage = LK.getAsset(roomBackgroundImages[bgImageIndex], {
anchorX: 0.5,
anchorY: 0.5
});
bgImage.x = 2048 / 2;
bgImage.y = 2732 / 2;
game.addChildAt(bgImage, 0);
game.background = bgImage;
currentRoom.isCleared = false;
hero.canExitRoom = false;
updateRoomDisplay();
}
function transitionToNewRoom(entrySide) {
if (entrySide === 'top') {
hero.y = 2732 - 10;
} else if (entrySide === 'bottom') {
hero.y = 10;
} else if (entrySide === 'left') {
hero.x = 2048 - 10;
} else if (entrySide === 'right') {
hero.x = 10;
}
stopRoomMusic();
transitionToNextRoom();
playRoomMusic(currentRoom.number);
hero.canExitRoom = false;
}
var hero = gameContainer.addChild(new Hero());
hero.x = 2048 / 2;
hero.y = 2732 / 2;
var healthText = new Text2('Health: ' + hero.health, {
size: 70,
fill: "#ffffff",
fontWeight: "bold"
});
healthText.x = 300;
healthText.y = 20;
game.addChild(healthText);
var joystick = uiContainer.addChild(new Joystick());
hero.joystick = joystick;
var killAllButton = LK.getAsset('killAllButton', {
anchorX: 0.5,
anchorY: 0.5
});
killAllButton.x = 100;
killAllButton.y = 2732 - 350;
uiContainer.addChild(killAllButton);
killAllButton.down = function (x, y, obj) {
if (isPopupActive || isDataSpikePopupActive) {
return;
}
for (var i = currentRoom.enemies.length - 1; i >= 0; i--) {
var enemy = currentRoom.enemies[i];
enemy.destroy();
currentRoom.enemies.splice(i, 1);
currentRoom.enemiesKilled++;
}
updateRoomDisplay();
checkRoomCleared();
updateRoomDisplay();
checkRoomCleared();
};
var attackButton = LK.getAsset('attackIcon', {
anchorX: 0.5,
anchorY: 0.5
});
attackButton.x = 2048 - 150;
attackButton.y = 2732 - 300;
uiContainer.addChild(attackButton);
attackButton.down = function (x, y, obj) {
if (isPopupActive) {
return;
}
if (hero.weaponType === 1) {
hero.isAttacking = true;
hero.attackCooldown = hero.attackDuration;
LK.setTimeout(function () {
hero.swordGraphics.rotation = 0.5;
}, hero.attackDuration * 10);
} else if (hero.weaponType === 2) {
var arrow = new Arrow();
arrow.x = hero.x;
arrow.y = hero.y;
arrow.rotation = hero.rotation;
arrows.push(arrow);
game.addChild(arrow);
}
};
var switchWeaponZone = LK.getAsset('switchWeaponZone', {
anchorX: 0.5,
anchorY: 0.5
});
switchWeaponZone.x = 2048 - switchWeaponZone.width / 2;
switchWeaponZone.y = 2732 / 2;
uiContainer.addChild(switchWeaponZone);
game.down = function (x, y, obj) {
if (isPopupActive) {
return;
}
if (x >= switchWeaponZone.x - switchWeaponZone.width / 2 && x <= switchWeaponZone.x + switchWeaponZone.width / 2 && y >= switchWeaponZone.y - switchWeaponZone.height / 2 && y <= switchWeaponZone.y + switchWeaponZone.height / 2) {
hero.weaponType = hero.weaponType === 1 ? 2 : 1;
hero.swordGraphics.visible = hero.weaponType === 1;
hero.bowGraphics.visible = hero.weaponType === 2;
return;
}
};
game.update = function () {
if (isPopupActive || gamePaused) {
// If paused or popup active, do not update hero or enemies
return;
}
if (hero.joystick && !isPopupActive && !gamePaused) {
var direction = hero.joystick.getDirection();
if (direction.x !== 0 || direction.y !== 0) {
hero.x += direction.x * hero.speed;
hero.y += direction.y * hero.speed;
hero.rotation = Math.atan2(direction.y, direction.x);
}
}
hero.update();
if (hero.health <= 0) {
hero.health = 0;
LK.showGameOver();
return;
}
if (hero.canExitRoom) {
if (hero.y < 10 || hero.y > 2732 - 10 || hero.x < 10 || hero.x > 2048 - 10) {
var entrySide = hero.y < 10 ? 'bottom' : hero.y > 2732 - 10 ? 'top' : hero.x < 10 ? 'right' : 'left';
transitionToNewRoom(entrySide);
}
}
for (var j = arrows.length - 1; j >= 0; j--) {
arrows[j].update();
for (var i = currentRoom.enemies.length - 1; i >= 0; i--) {
var hitDx = currentRoom.enemies[i].x - arrows[j].x;
var hitDy = currentRoom.enemies[i].y - arrows[j].y;
var hitDist = Math.sqrt(hitDx * hitDx + hitDy * hitDy);
if (hitDist < 60) {
currentRoom.enemies[i].health -= arrows[j].damage;
if (currentRoom.enemies[i].health <= 0) {
currentRoom.enemiesKilled++;
currentRoom.enemyCounter--;
if (currentRoom.enemies[i].parent) {
currentRoom.enemies[i].parent.removeChild(currentRoom.enemies[i]);
}
currentRoom.enemies[i].destroy();
currentRoom.enemies.splice(i, 1);
updateRoomDisplay();
}
if (arrows[j]) {
arrows[j].destroy();
arrows.splice(j, 1);
}
break;
}
}
}
if (!isPopupActive) {
for (var k = 0; k < currentRoom.enemies.length; k++) {
currentRoom.enemies[k].update();
}
}
checkRoomCleared();
};
function createSkillPopup(skillTitle, skillDescription) {
var skillPopup = new Container();
skillPopup.width = 2048;
skillPopup.height = 2732;
skillPopup.x = 0;
skillPopup.y = 0;
var translucentBackground = LK.getAsset('box', {
anchorX: 0.5,
anchorY: 0.5,
width: 2048,
height: 2732,
color: 0x000000,
alpha: 0.5
});
translucentBackground.x = 2048 / 2;
translucentBackground.y = 2732 / 2;
skillPopup.addChild(translucentBackground);
var skillTitleText = new Text2(skillTitle, {
size: 120,
fill: "#ffffff",
fontWeight: "bold",
fontFamily: "Techno, sans-serif",
letterSpacing: 2,
stroke: "#00ffcc",
strokeThickness: 3
});
skillTitleText.x = 2048 / 2;
skillTitleText.y = 2732 / 2 + 150;
skillTitleText.anchor.set(0.5, 0.5);
skillPopup.addChild(skillTitleText);
var skillDescriptionText = new Text2(skillDescription, {
size: 80,
fill: "#ffffff",
fontFamily: "Arial, sans-serif",
letterSpacing: 1,
stroke: "#00ffcc",
strokeThickness: 2,
wordWrap: true,
wordWrapWidth: 1800
});
skillDescriptionText.x = 2048 / 2;
skillDescriptionText.y = skillTitleText.y + 150;
skillDescriptionText.anchor.set(0.5, 0.5);
skillPopup.addChild(skillDescriptionText);
var exitButton = LK.getAsset('cancelButton', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 3,
scaleY: 3
});
exitButton.x = 2048 / 2 - 600;
exitButton.y = 2732 / 2 + 850;
exitButton.down = function () {
menuContainer.removeChild(skillPopup);
isDataSpikePopupActive = false;
};
skillPopup.addChild(exitButton);
var spendButton = LK.getAsset('spendButton', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 3,
scaleY: 3
});
spendButton.x = 2048 / 2 + 600;
spendButton.y = 2732 / 2 + 850;
function refreshSkillPointsText() {
if (typeof skillPointsDisplay !== 'undefined') {
skillPointsDisplay.setText('Skill Points: ' + heroSkillPoints);
}
if (typeof skillPointsText !== 'undefined') {
skillPointsText.setText('Skill Points: ' + heroSkillPoints);
}
}
spendButton.down = function () {
if (heroSkillPoints > 0) {
heroSkillPoints--;
refreshSkillPointsText(); // Update text after spending
refreshTreePointsText(); // Update tree points text if visible
// You can add any skill unlocking logic here if needed
} else {
// No skill points left, optionally do nothing
}
};
skillPopup.addChild(spendButton);
var skillPointsText = new Text2('Skill Points: ' + heroSkillPoints, {
size: 70,
fill: "#ffffff",
fontWeight: "bold"
});
skillPointsText.x = 2048 / 2;
skillPointsText.y = 2732 - 100; // bottom area of popup
skillPointsText.anchor.set(0.5, 0);
skillPopup.addChild(skillPointsText);
return skillPopup;
}
function displayOverloadBlastPopup() {
var overloadBlastPopup = createSkillPopup('Overload Blast', 'Unleashes a massive explosion that damages all enemies in the room.');
menuContainer.addChild(overloadBlastPopup);
isDataSpikePopupActive = true;
}
function displayPowerSurgePopup() {
var powerSurgePopup = createSkillPopup('Power Surge', 'Releases an energy burst that damages all nearby enemies.');
menuContainer.addChild(powerSurgePopup);
isDataSpikePopupActive = true;
}
function displayDodgeMatrixPopup() {
var dodgeMatrixPopup = createSkillPopup('Dodge Matrix', 'Grants a 10% chance to evade enemy attacks.');
menuContainer.addChild(dodgeMatrixPopup);
isDataSpikePopupActive = true;
}
function displayNeuralHijackPopup() {
var neuralHijackPopup = createSkillPopup('Neural Hijack', 'Temporarily converts an enemy to fight for you.');
menuContainer.addChild(neuralHijackPopup);
isDataSpikePopupActive = true;
}
function displayOverclockCorePopup() {
var overclockCorePopup = createSkillPopup('Overclock Core', 'Increases attack speed (2.5%) and energy regeneration by 2%.');
menuContainer.addChild(overclockCorePopup);
isDataSpikePopupActive = true;
}
function displayReflexAcceleratorPopup() {
var reflexAcceleratorPopup = createSkillPopup('Reflex Accelerator', 'Boosts movement speed by 10%.');
menuContainer.addChild(reflexAcceleratorPopup);
isDataSpikePopupActive = true;
}
function displayDataSpikePopup() {
var dataSpikePopup = createSkillPopup('Data Spike', 'Increases critical hit chance by 5%.');
menuContainer.addChild(dataSpikePopup);
isDataSpikePopupActive = true;
}
function openSkillTreePopup(skillTreeName) {
menuContainer.removeChild(skillTreePopup);
var newPopup = new Container();
newPopup.width = 2048;
newPopup.height = 2732;
newPopup.x = 0;
newPopup.y = 0;
var newPopupBackground = LK.getAsset('skillTree_Background', {
anchorX: 0.5,
anchorY: 0.5
});
newPopupBackground.x = 2048 / 2;
newPopupBackground.y = 2732 / 2;
newPopup.addChild(newPopupBackground);
if (skillTreeName === 'The Circuit of Ascension') {
var circuitAsset = LK.getAsset('popup_circuitofascension', {
anchorX: 0.5,
anchorY: 0.5
});
circuitAsset.x = 2048 / 2;
circuitAsset.y = 2732 / 2;
newPopup.x = (2048 - newPopup.width) / 2;
newPopup.y = (2732 - newPopup.height) / 2;
newPopup.addChild(circuitAsset);
var backButton = new BackButton();
newPopup.addChild(backButton);
var skillNodes = [{
id: 'data_spike_icon',
x: 2048 / 4,
y: 2732 / 6,
name: 'Data Spike'
}, {
id: 'reflex_accelerator_icon',
x: 2048 / 2,
y: 2732 / 6,
name: 'Reflex Accelerator'
}, {
id: 'overclock_core_icon',
x: 3 * 2048 / 4,
y: 2732 / 6,
name: 'Overclock Core'
}, {
id: 'neural_hijack_icon',
x: 2048 / 4,
y: 2 * 2732 / 6,
name: 'Neural Hijack'
}, {
id: 'dodge_matrix_icon',
x: 2048 / 2,
y: 2 * 2732 / 6,
name: 'Dodge Matrix'
}, {
id: 'brown_node_icon',
x: 3 * 2048 / 4,
y: 2 * 2732 / 6,
name: 'Power Surge'
}, {
id: 'ultimate_skill_icon',
x: 2048 / 2,
y: 3 * 2732 / 6,
name: 'Ultimate Skill'
}];
skillNodes.forEach(function (node) {
var skillNode = LK.getAsset(node.id, {
anchorX: 0.5,
anchorY: 0.5
});
skillNode.x = node.x;
skillNode.y = node.y;
skillNode.down = function () {
if (isDataSpikePopupActive) {
return;
}
if (node.name === 'Data Spike') {
displayDataSpikePopup();
isDataSpikePopupActive = true;
} else if (node.name === 'Overclock Core') {
displayOverclockCorePopup();
isDataSpikePopupActive = true;
} else if (node.name === 'Reflex Accelerator') {
displayReflexAcceleratorPopup();
isDataSpikePopupActive = true;
} else if (node.name === 'Neural Hijack') {
displayNeuralHijackPopup();
isDataSpikePopupActive = true;
} else if (node.name === 'Dodge Matrix') {
displayDodgeMatrixPopup();
isDataSpikePopupActive = true;
} else if (node.name === 'Power Surge') {
displayPowerSurgePopup();
isDataSpikePopupActive = true;
} else if (node.name === 'Ultimate Skill') {
displayOverloadBlastPopup();
isDataSpikePopupActive = true;
}
var originalColor = skillNode.tint;
skillNode.tint = 0xffff00;
LK.setTimeout(function () {
skillNode.tint = originalColor;
}, 1000);
};
newPopup.addChild(skillNode);
});
} else if (skillTreeName === 'The Echoes of Ancestry') {
var ancestryAsset = LK.getAsset('popup_echoesofancestry', {
anchorX: 0.5,
anchorY: 0.5
});
ancestryAsset.x = 2048 / 2;
ancestryAsset.y = 2732 / 2;
newPopup.addChild(ancestryAsset);
} else if (skillTreeName === 'The Forge of Possibilities') {
var forgeAsset = LK.getAsset('popup_forgeofpossibilities', {
anchorX: 0.5,
anchorY: 0.5
});
forgeAsset.x = 2048 / 2;
forgeAsset.y = 2732 / 2;
newPopup.addChild(forgeAsset);
} else if (skillTreeName === 'The Prism of Potential') {
var prismAsset = LK.getAsset('popup_prismofpotential', {
anchorX: 0.5,
anchorY: 0.5
});
prismAsset.x = 2048 / 2;
prismAsset.y = 2732 / 2;
newPopup.addChild(prismAsset);
} else if (skillTreeName === 'The Nexus of Chaos') {
var nexusAsset = LK.getAsset('popup_nexusofchaos', {
anchorX: 0.5,
anchorY: 0.5
});
nexusAsset.x = 2048 / 2;
nexusAsset.y = 2732 / 2;
newPopup.addChild(nexusAsset);
} else if (skillTreeName === 'The Symphony of Shadows') {
var symphonyAsset = LK.getAsset('popup_symphonyofshadows', {
anchorX: 0.5,
anchorY: 0.5
});
symphonyAsset.x = 2048 / 2;
symphonyAsset.y = 2732 / 2;
newPopup.addChild(symphonyAsset);
}
var skillTreeTitle = new Text2(skillTreeName, {
size: 150,
fill: "#ffffff",
fontWeight: "bold",
fontFamily: "Techno, sans-serif",
letterSpacing: 2,
stroke: "#00ffcc",
strokeThickness: 3
});
skillTreeTitle.x = 2048 / 2;
skillTreeTitle.y = 100;
skillTreeTitle.anchor.set(0.5, 0);
newPopup.addChild(skillTreeTitle);
// Create skillTreePointsText at the bottom of the newPopup
skillTreePointsText = new Text2('Skill Points: ' + heroSkillPoints, {
size: 70,
fill: "#ffffff",
fontWeight: "bold"
});
skillTreePointsText.x = 2048 / 2;
skillTreePointsText.y = 2732 - 100; // bottom of the screen
skillTreePointsText.anchor.set(0.5, 0);
newPopup.addChild(skillTreePointsText);
refreshTreePointsText(); // Update skill points display
menuContainer.addChild(newPopup);
} ===================================================================
--- original.js
+++ change.js
@@ -278,22 +278,15 @@
/****
* Game Code
****/
-// Containers are defined once at the start of the Game Code section
-var uiContainer = new Container();
-var menuContainer = new Container();
-game.addChild(uiContainer);
-game.addChild(menuContainer);
-// Ensure uiContainer is defined above
var openSkillTreeButton = LK.getAsset('attackIcon', {
anchorX: 0.5,
anchorY: 0.5
});
-// Place it somewhere on the screen
+// Place it somewhere on the screen, for example top-left corner
openSkillTreeButton.x = 200;
openSkillTreeButton.y = 200;
-// Now uiContainer is defined, so we can add the button
uiContainer.addChild(openSkillTreeButton);
openSkillTreeButton.down = function (x, y, obj) {
if (!isPopupActive && gameStarted) {
// Open the skillTreePopup again
@@ -372,9 +365,15 @@
x: roomWidth - wallThickness,
y: roomHeight - wallThickness
}
};
-// Containers are defined once at the start of the Game Code section
+var gameContainer = new Container();
+var uiContainer = new Container();
+game.addChild(uiContainer);
+var menuContainer = new Container();
+game.addChild(gameContainer);
+game.addChild(uiContainer);
+game.addChild(menuContainer);
var skillTreePopup = new Container();
skillTreePopup.width = 2048;
skillTreePopup.height = 2732;
skillTreePopup.x = 0;
A round button with icons of a sword and bow crossed over a shield, hinting at weapon switching.. Game interface icon. Medieval theme with crossed weapons on a shield. High contrast and intuitive design.
A rugged medieval bow with a wooden frame and slightly frayed string, perfect for a fantasy setting.. Game asset. Rustic and worn. Medieval fantasy style. High detail with visible wood grain.
Remove the joystick stick
A dark, stone-walled dungeon chamber viewed directly from above. The floor is uneven with scattered bones and chains. Each wall has an entrance centered in the middle, like arched doorways, positioned on the top, bottom, left, and right sides. The room fills the entire frame, with torch-lit ambiance.. Full-frame, top-down view of a stone-walled dungeon chamber. Uneven floor, bones, chains, torch lighting. Open, arched entrances centered on each wall: top, bottom, left, and right. No 3D perspective, even lighting.
A high-tech command center with a glowing grid floor and sleek metallic walls. The room is viewed from directly above and has open entrances centered in the middle of each wall (top, bottom, left, and right) for easy transitions. Neon lights and holographic screens line the walls, casting a blue glow.. Full-frame, top-down view of a futuristic command center. Glowing grid floor, metallic walls, neon lights. Open entrances centered on each wall: top, bottom, left, and right. Blue glow, no perspective distortion.
A top-down view of jungle ruins with moss-covered stone walls and floors. The floor is scattered with vines and broken pillars. Each wall has an entrance centered in the middle, resembling natural archways positioned on the top, bottom, left, and right. Sunlight filters through, illuminating the room softly.. Full-frame, top-down view of jungle ruins. Moss-covered stone walls and floors, vines, broken pillars. Open natural archways centered on each wall: top, bottom, left, and right. Soft sunlight, no perspective distortion.
A pixelated skull with green digital "code streams" dripping down, symbolizing a destructive digital attack. Neon green and dark gray.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A circular emblem with a tree at its center, its branches intertwining with a glowing red lineage symbol.. Colors: Deep red, gold, and subtle white highlights.
Elemental Gear Icon: A gear made of multiple materials (fire, ice, lightning, and shadow) fused together, symbolizing crafting hybrid powers.. Colors: Vibrant orange, blue, yellow, and dark purple.
Shattered Prism Icon: A cracked prism emitting chaotic light beams, symbolizing untapped magical potential.. Colors: Neon purple and silver with multicolored light fragments.
Fractured Sphere Icon: A glowing orb breaking apart into jagged, floating shards, with chaotic energy swirling around it.. Colors: Neon purple, black, and electric green.
Phantom Mask Icon: A mysterious, floating mask with glowing eyes and tendrils of shadow curling around it, symbolizing illusions and deception.. Colors: White mask with glowing blue accents and black shadows.
Backdrop: An ancient, mystical forest with glowing runes etched into massive tree trunks. Colors: Earthy greens and browns with soft golden accents. Details: Misty ambiance with faint ethereal figures in the background.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Backdrop: A grand forge surrounded by molten lava and glowing hammers mid-swing. Colors: Fiery reds and oranges with metallic silver and gray. Details: Sparks flying and glowing weapon fragments scattered around.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Backdrop: A crystal cavern with refracted light beams splitting into vibrant colors. Colors: Radiant rainbow hues with a soft, dark background. Details: Floating crystals and magical glowing particles.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Backdrop: A warped reality scene with twisting, fragmented terrain and a swirling vortex in the background. Colors: Deep purples, neon pinks, and electric greens. Details: Fractured floating rocks and glitch-like patterns.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Backdrop: A dark, shadowy realm with faint glowing outlines of jagged structures and flowing mist. Colors: Black, deep purples, and faint blue highlights. Details: Shadows shifting and subtle glowing runes.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Weapon switch icon. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Start game button. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Big red kill button. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Top-down view of a floating mechanical robot with a circular body. Thin, robotic arms extend outward, metallic and glowing. The head is small with glowing eyes. Strictly top-down view, no perspective or angle. Clean and detailed for 2D gameplay. Single Game Texture. In-Game asset. Top-down view. No shadows. 2D style. High contrast. Blank background.
A futuristic, top-down 2D game room featuring a minimalist industrial design. The room should have four distinct doorways at cardinal directions (up, down, left, and right). Each doorway should blend seamlessly into the room's aesthetic, with metallic frames and subtle glowing edges to indicate navigability. The room maintains its clean, tiled walls and floor, accented with industrial details like exposed pipes, vents, and panels. Lighting is ambient, with a mix of warm tones near the top and cooler tones along the walls. The overall theme is a high-tech but slightly weathered environment, ready for player navigation. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
A Dagger Icon with 1's and 0's dripping off of it like blood. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A stylized, sleek cybernetic boot or leg silhouette with clear motion lines trailing behind it (like speed lines). Alternatively, three chevrons (>>>) pointing forward, glowing with blue energy, suggesting rapid advancement.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Two stylized head silhouettes (one representing the hero, one the enemy) connected by arcing lines of digital energy or circuit patterns. Color could be a mix of blue (control) and maybe red/purple (target).. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A shield shape formed from a 1's and 0's matrix pattern (like circuitry). Some lines of the grid could be missing or 'glitching' out, suggesting attacks passing through harmlessly. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Concentric circles or energy waves expanding outwards from a central point. The waves could be depicted as sharp lines of light blue or white energy. Could also incorporate small lightning-like sparks within the surge.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A more intense version of Power Surge. A fractured or exploding core shape at the center, emitting powerful, jagged energy waves (possibly in yellow or orange on top of blue). Could incorporate classic explosion symbol elements but rendered in the cybernetic style. Should look significantly more powerful than Power Surge.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
a cracked stone tablet or ancient scroll depicting elemental symbols with a subtle glow.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A hand silhouette centrally placed, with symbolic representations of different elements (fire, ice/water, lightning/wind) swirling around it or emanating from the fingertips. Could also be intersecting elemental runes.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A primal stone axe or spearhead with stylized speed lines or a spectral blue aura indicating swift movement.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A glowing paw print (wolf, bear, or cat-like) leaving a faint spectral trail.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A bundle of glowing green herbs tied together, or a single stylized leaf with potent green light radiating from its veins.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
a translucent, ghostly shield or a faint outline of a guardian spirit figure.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
An imposing, ornate tribal mask or helmet, perhaps with glowing eyes or runic carvings.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A stylized hammer striking an anvil, creating fiery sparks or engulfing the hammer head in flames.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A potion bottle or flask swirling with multiple distinct colors (red, blue, green).. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A arrow and sword splitting into a double arrow and double sword signifying a extra shot/sword.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Could also be a stylized recycling symbol combined with an upward arrow or a plus sign.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A symbol merging a sword and an arrow/bow, perhaps crossing each other with energy flowing between them.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A stylized metallic bracer or weapon hilt showing empty sockets being filled by small, glowing runes or gems.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A glowing, ornate hammer imbued with power, or a weapon silhouette undergoing a visible transformation with radiating light and complex runic patterns.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A sharp, faceted red crystal or gem shard glowing hotly.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
An angular, crystalline shield shimmering with blue light.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Could also be a green crystal pulsing with soft light.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A sharp, angular gust of wind symbol in bright yellow, or a stylized yellow feather.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A sharply focused eye symbol in deep indigo color. Could also be a fractured mirror shard reflecting light, or an indigo crystal with internal sparks/light flashes.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Two different colored streams of energy (e.g., red and blue) flowing and swirling together in the center. Could also be a crystal icon split into two distinct colors.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A classic prism shape refracting a beam of white light into a rainbow spectrum. Could also be a figure surrounded by a swirling aura containing all the skill colors.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A crackling spark of energy rapidly shifting between multiple colors (purple, green, orange). Could also be a die symbol with elemental icons instead of pips, or a weapon impact with a question mark.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A shield shape that looks warped, dissolving at the edges, or made of static/glitches. Could show an arrow bouncing off at a weird angle or fizzling into nothing.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A jagged tear or swirling vortex in space, leaking multi-colored, chaotic energy. Could incorporate shifting, abstract symbols or question marks within the rift.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A silhouette of the hero glitching or flickering between different colors or slightly different forms. Could also be an upward arrow surrounded by swirling question marks or dice symbols.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A branching pattern like lightning or cracks, but made of chaotic, multi-colored energy. Could also be a visual of one chaotic explosion triggering others nearby.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A clock face or hourglass that is visibly cracked or shattering. Could also be a die symbol mid-roll or showing multiple faces at once.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
An imploding geometric shape or structure crumbling inwards into a chaotic void/vortex. Could be an intense version of the Unstable Rift, looking more menacing and powerful.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A boot icon dissolving into smoke or shadow at the heel. Sound wave symbol with a line striking through it, indicating silence.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A stylized cloak hood casting a deep shadow, with only faint eyes or nothing visible within. Could also be a figure splitting into a solid version and a shadowy decoy.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A sharp, wicked-looking dagger or blade edge dripping with black, shadowy substance.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A silhouette of a small, mischievous shadow creature (imp, tendril beast, raven?). Could also be a pair of glowing eyes peering out from darkness.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A dagger or fist icon striking, but with sound waves around it being cancelled or muffled (e.g., crossed out or dissolving).. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A central figure with several fading, translucent shadow copies trailing behind or positioned nearby. Could also be a weapon swing that leaves dark afterimages.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows