User prompt
option to contain SCP's and anomolys,
User prompt
gameboard can be random
User prompt
cards can spawn what they say
User prompt
cards have options
User prompt
make it so you can drag cards to use them
User prompt
cards have random art
User prompt
make Director Tilda Moose a card
User prompt
make text on cards red
User prompt
make text red
User prompt
add more to the game
User prompt
make the game fullscreen
User prompt
random gamemode on start
User prompt
cards have random stats, descriptions, SCP's, companions, titles, effects
User prompt
Add random SCP’s of all classes
User prompt
Card Title: Island Turtle Subtitle: Lazy Archipelago Type: Land Description: If you are at sea, this card spawns an Island Turtle to ferry you around. If you’re not, the turtle spawns anyway, and dies from dehydration.
User prompt
add everything: Card Title: Darkness Between Dimensions Subtitle: A Red Reality Type: Land Description: Spawns a machine that, after a random amount of time, will transport anything nearby into the Darkness Between Dimensions. Players in the Darkness Between Dimensions can be saved by divine grace, or with the item “Scranton’s Grappling Hook”. After a random amount of time, players will be returned to the board. They will come back... squishier.
User prompt
Card Title: Darkness Between Dimensions Subtitle: A Red Reality Type: Land Description: Spawns a machine that, after a random amount of time, will transport anything nearby into the Darkness Between Dimensions. Players in the Darkness Between Dimensions can be saved by divine grace, or with the item “Scranton’s Grappling Hook”. After a random amount of time, players will be returned to the board. They will come back... squishier.
User prompt
dobble click to use cards
User prompt
move cards to the board to use them
User prompt
gamemode changer
User prompt
gamemode options
User prompt
Apollyon Mode: Two random, hostile supreme divine beings appear on the map after the fourth turn. Players may start the game blind.
User prompt
Please fix the bug: 'initOpponents is not defined' in or related to this line: 'initOpponents();' Line Number: 1051
User prompt
Please fix the bug: 'initPlayerEntity is not defined' in or related to this line: 'initPlayerEntity();' Line Number: 1050
User prompt
add player and opponent teams
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1", { highScore: 0, playerLevel: 1, containedAnomalies: 0 }); /**** * Classes ****/ var Button = Container.expand(function () { var self = Container.call(this); self.background = self.attachAsset('button', { anchorX: 0.5, anchorY: 0.5 }); self.text = new Text2('Button', { size: 24, fill: 0xFFFFFF }); self.text.anchor.set(0.5, 0.5); self.addChild(self.text); self.setText = function (text) { self.text.setText(text); }; self.setCallback = function (callback) { self.callback = callback; }; self.down = function (x, y, obj) { tween(self, { scaleX: 0.95, scaleY: 0.95 }, { duration: 100, easing: tween.easeOut }); }; self.up = function (x, y, obj) { tween(self, { scaleX: 1, scaleY: 1 }, { duration: 100, easing: tween.easeOut }); if (self.callback) { self.callback(); } }; return self; }); var Card = Container.expand(function () { var self = Container.call(this); // Card properties self.cardType = 'none'; self.cardName = ''; self.cardDescription = ''; self.power = 0; self.cost = 0; self.revealed = false; // Card visuals self.back = self.attachAsset('cardBack', { anchorX: 0.5, anchorY: 0.5 }); self.front = self.attachAsset('cardFront', { anchorX: 0.5, anchorY: 0.5, alpha: 0 }); self.nameText = new Text2('', { size: 20, fill: 0x000000 }); self.nameText.anchor.set(0.5, 0); self.nameText.y = -70; self.addChild(self.nameText); self.descriptionText = new Text2('', { size: 16, fill: 0x000000 }); self.descriptionText.anchor.set(0.5, 0); self.descriptionText.y = 0; self.descriptionText.alpha = 0; self.addChild(self.descriptionText); self.powerText = new Text2('', { size: 24, fill: 0xFF0000 }); self.powerText.anchor.set(0.5, 0.5); self.powerText.x = 50; self.powerText.y = 70; self.powerText.alpha = 0; self.addChild(self.powerText); self.costText = new Text2('', { size: 24, fill: 0x0000FF }); self.costText.anchor.set(0.5, 0.5); self.costText.x = -50; self.costText.y = 70; self.costText.alpha = 0; self.addChild(self.costText); // Initialize a card with data self.init = function (data) { self.cardType = data.type; self.cardName = data.name; self.cardDescription = data.description; self.power = data.power || 0; self.cost = data.cost || 0; self.nameText.setText(self.cardName); self.descriptionText.setText(self.cardDescription); self.powerText.setText(self.power.toString()); self.costText.setText(self.cost.toString()); }; // Flip the card to reveal front self.reveal = function () { if (!self.revealed) { tween(self.back, { alpha: 0 }, { duration: 300, easing: tween.easeInOut }); tween(self.front, { alpha: 1 }, { duration: 300, easing: tween.easeInOut }); tween(self.descriptionText, { alpha: 1 }, { duration: 300, easing: tween.easeInOut }); tween(self.powerText, { alpha: 1 }, { duration: 300, easing: tween.easeInOut }); tween(self.costText, { alpha: 1 }, { duration: 300, easing: tween.easeInOut }); self.revealed = true; } }; // Flip card back self.hide = function () { if (self.revealed) { tween(self.back, { alpha: 1 }, { duration: 300, easing: tween.easeInOut }); tween(self.front, { alpha: 0 }, { duration: 300, easing: tween.easeInOut }); tween(self.descriptionText, { alpha: 0 }, { duration: 300, easing: tween.easeInOut }); tween(self.powerText, { alpha: 0 }, { duration: 300, easing: tween.easeInOut }); tween(self.costText, { alpha: 0 }, { duration: 300, easing: tween.easeInOut }); self.revealed = false; } }; // Card interaction events self.down = function (x, y, obj) { tween(self, { scaleX: 1.1, scaleY: 1.1 }, { duration: 100, easing: tween.easeOut }); }; self.up = function (x, y, obj) { tween(self, { scaleX: 1, scaleY: 1 }, { duration: 100, easing: tween.easeOut }); // Check for double-click if (self.lastClickTime && Date.now() - self.lastClickTime < 300) { // Trigger card selection in the game if (typeof cardSelected === 'function') { cardSelected(self); } } self.lastClickTime = Date.now(); if (!self.revealed) { self.reveal(); LK.getSound('cardDraw').play(); } }; return self; }); var Entity = Container.expand(function () { var self = Container.call(this); // Entity properties self.entityType = 'none'; self.health = 100; self.maxHealth = 100; self.energy = 100; self.maxEnergy = 100; self.power = 10; self.moveRange = 3; self.boardX = 0; self.boardY = 0; self.isMoving = false; self.isPlayer = false; // Entity visuals self.graphic = null; self.healthBarBg = self.attachAsset('barBackground', { anchorX: 0.5, anchorY: 0.5, y: -45 }); self.healthBar = self.attachAsset('healthBar', { anchorX: 0, anchorY: 0.5, x: -30, y: -45 }); self.energyBarBg = self.attachAsset('barBackground', { anchorX: 0.5, anchorY: 0.5, y: -35 }); self.energyBar = self.attachAsset('energyBar', { anchorX: 0, anchorY: 0.5, x: -30, y: -35 }); self.nameText = new Text2('', { size: 16, fill: 0xFFFFFF }); self.nameText.anchor.set(0.5, 1); self.nameText.y = -50; self.addChild(self.nameText); // Initialize entity with data self.init = function (data, isPlayerEntity) { self.entityType = data.type; self.health = data.health || 100; self.maxHealth = data.maxHealth || 100; self.energy = data.energy || 100; self.maxEnergy = data.maxEnergy || 100; self.power = data.power || 10; self.moveRange = data.moveRange || 3; self.isPlayer = isPlayerEntity || false; // Set up appropriate graphic based on type if (self.isPlayer) { self.graphic = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); } else if (self.entityType === 'opponent') { self.graphic = self.attachAsset('opponent', { anchorX: 0.5, anchorY: 0.5 }); } else if (self.entityType === 'anomaly') { self.graphic = self.attachAsset('anomaly', { anchorX: 0.5, anchorY: 0.5 }); } self.nameText.setText(data.name || self.entityType); self.updateBars(); }; // Update health and energy bars self.updateBars = function () { var healthPercent = self.health / self.maxHealth; var energyPercent = self.energy / self.maxEnergy; self.healthBar.width = 60 * healthPercent; self.energyBar.width = 60 * energyPercent; }; // Take damage self.takeDamage = function (amount) { self.health -= amount; if (self.health <= 0) { self.health = 0; self.die(); } self.updateBars(); LK.effects.flashObject(self, 0xff0000, 300); }; // Use energy self.useEnergy = function (amount) { if (self.energy >= amount) { self.energy -= amount; self.updateBars(); return true; } return false; }; // Restore health self.heal = function (amount) { self.health += amount; if (self.health > self.maxHealth) { self.health = self.maxHealth; } self.updateBars(); LK.effects.flashObject(self, 0x00ff00, 300); }; // Restore energy self.restoreEnergy = function (amount) { self.energy += amount; if (self.energy > self.maxEnergy) { self.energy = self.maxEnergy; } self.updateBars(); LK.effects.flashObject(self, 0x0088ff, 300); }; // Move to a board position self.moveToPosition = function (boardX, boardY) { if (self.isMoving) { return; } self.isMoving = true; self.boardX = boardX; self.boardY = boardY; var targetX = BOARD_OFFSET_X + boardX * TILE_SIZE + TILE_SIZE / 2; var targetY = BOARD_OFFSET_Y + boardY * TILE_SIZE + TILE_SIZE / 2; tween(self, { x: targetX, y: targetY }, { duration: 500, easing: tween.easeInOut, onFinish: function onFinish() { self.isMoving = false; LK.getSound('playerMove').play(); // Check for anomaly at this position checkForAnomalyAtPosition(boardX, boardY); } }); }; // Attack another entity self.attack = function (target) { if (!target) { return; } if (self.useEnergy(20)) { LK.getSound('playerAttack').play(); // Animation var originalX = self.x; var originalY = self.y; var targetX = target.x; var targetY = target.y; // Move towards target tween(self, { x: originalX + (targetX - originalX) * 0.7, y: originalY + (targetY - originalY) * 0.7 }, { duration: 200, easing: tween.easeIn, onFinish: function onFinish() { // Apply damage target.takeDamage(self.power); // Move back tween(self, { x: originalX, y: originalY }, { duration: 300, easing: tween.easeOut }); } }); } }; // Die function self.die = function () { tween(self, { alpha: 0, scaleX: 0.5, scaleY: 0.5 }, { duration: 500, easing: tween.easeIn, onFinish: function onFinish() { self.destroy(); if (self.entityType === 'anomaly') { containAnomaly(self); } // Check if game is over checkGameState(); } }); }; // Entity interaction events self.down = function (x, y, obj) { if (gameState !== GAME_STATE.PLAYER_TURN) { return; } if (self.isPlayer) { // Select the player selectEntity(self); } else if (selectedEntity && selectedEntity.isPlayer) { // If player is selected and this is another entity, try to attack var dx = Math.abs(selectedEntity.boardX - self.boardX); var dy = Math.abs(selectedEntity.boardY - self.boardY); if (dx <= 1 && dy <= 1) { selectedEntity.attack(self); endPlayerTurn(); } } }; return self; }); var Highlight = Container.expand(function () { var self = Container.call(this); self.graphic = self.attachAsset('highlight', { anchorX: 0.5, anchorY: 0.5, alpha: 0.3 }); self.boardX = 0; self.boardY = 0; self.setPosition = function (bx, by) { self.boardX = bx; self.boardY = by; self.x = BOARD_OFFSET_X + bx * TILE_SIZE + TILE_SIZE / 2; self.y = BOARD_OFFSET_Y + by * TILE_SIZE + TILE_SIZE / 2; }; self.down = function (x, y, obj) { if (gameState !== GAME_STATE.PLAYER_TURN || !selectedEntity || !selectedEntity.isPlayer) { return; } // Calculate the distance between selected entity and this highlight var dx = Math.abs(selectedEntity.boardX - self.boardX); var dy = Math.abs(selectedEntity.boardY - self.boardY); var distance = Math.max(dx, dy); // Check if we can move there if (distance <= selectedEntity.moveRange) { // Check if the destination is empty if (isTileEmpty(self.boardX, self.boardY)) { selectedEntity.moveToPosition(self.boardX, self.boardY); clearHighlights(); endPlayerTurn(); } } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ function transportEntitiesToDarkness(machine) { var nearbyEntities = []; // Find entities near the machine for (var i = 0; i < playerEntities.length; i++) { if (Math.abs(playerEntities[i].boardX - machine.boardX) <= 1 && Math.abs(playerEntities[i].boardY - machine.boardY) <= 1) { nearbyEntities.push(playerEntities[i]); } } for (var i = 0; i < opponentEntities.length; i++) { if (Math.abs(opponentEntities[i].boardX - machine.boardX) <= 1 && Math.abs(opponentEntities[i].boardY - machine.boardY) <= 1) { nearbyEntities.push(opponentEntities[i]); } } // Transport entities to the Darkness Between Dimensions for (var i = 0; i < nearbyEntities.length; i++) { (function (entity) { entity.alpha = 0; // Make entity invisible LK.setTimeout(function () { entity.alpha = 1; // Return entity to the board entity.health = Math.max(1, entity.health - 10); // Make them "squishier" entity.updateBars(); }, Math.random() * 5000 + 2000); // Random return time between 2 to 7 seconds })(nearbyEntities[i]); } } // Game constants function spawnSupremeDivineBeings() { for (var i = 0; i < 2; i++) { var divineBeing = new Entity(); divineBeing.init({ type: 'divine', name: 'Supreme Divine ' + (i + 1), health: 200, maxHealth: 200, energy: 150, maxEnergy: 150, power: 50, moveRange: 4 }); // Find a random empty position for the divine being var randomX, randomY; do { randomX = Math.floor(Math.random() * BOARD_SIZE); randomY = Math.floor(Math.random() * BOARD_SIZE); } while (!isTileEmpty(randomX, randomY)); divineBeing.boardX = randomX; divineBeing.boardY = randomY; divineBeing.x = BOARD_OFFSET_X + divineBeing.boardX * TILE_SIZE + TILE_SIZE / 2; divineBeing.y = BOARD_OFFSET_Y + divineBeing.boardY * TILE_SIZE + TILE_SIZE / 2; game.addChild(divineBeing); opponentEntities.push(divineBeing); } } var BOARD_SIZE = 8; var TILE_SIZE = 120; var BOARD_OFFSET_X = (2048 - BOARD_SIZE * TILE_SIZE) / 2; var BOARD_OFFSET_Y = (2732 - BOARD_SIZE * TILE_SIZE) / 2 - 100; var GAME_STATE = { SETUP: 0, PLAYER_TURN: 1, OPPONENT_TURN: 2, GAME_OVER: 3 }; // Game mode options var gameModes = { standard: { description: "Standard game mode with normal rules.", init: function init() { initPlayerTeam(); initOpponents(); initAnomalies(); } }, apollyon: { description: "Apollyon Mode: Two random, hostile supreme divine beings appear on the map after the fourth turn.", init: function init() { initPlayerTeam(); initOpponents(); initAnomalies(); // Additional setup for Apollyon Mode spawnSupremeDivineBeings(); } } }; // Game variables var gameBoard = []; var gameState = GAME_STATE.SETUP; var playerEntities = []; var opponentEntities = []; var anomalies = []; var selectedEntity = null; var highlights = []; var cards = []; var score = 0; var turnCounter = 0; var playerHand = []; var cardsInDeck = 20; // Game board and UI var boardGraphic = game.addChild(LK.getAsset('board', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: BOARD_OFFSET_Y + BOARD_SIZE * TILE_SIZE / 2 })); boardGraphic.width = BOARD_SIZE * TILE_SIZE; boardGraphic.height = BOARD_SIZE * TILE_SIZE; // Score text var scoreTxt = new Text2('Score: 0', { size: 50, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); scoreTxt.y = 20; // Turn indicator var turnTxt = new Text2('Player Turn', { size: 40, fill: 0xFFFFFF }); turnTxt.anchor.set(0.5, 0); LK.gui.top.addChild(turnTxt); turnTxt.y = 80; // Draw card button var drawCardBtn = new Button(); drawCardBtn.setText('Draw Card (' + cardsInDeck + ')'); drawCardBtn.x = 2048 - 150; drawCardBtn.y = 2732 - 100; game.addChild(drawCardBtn); // Add card deck icon var cardDeckIcon = LK.getAsset('cardBack', { anchorX: 0.5, anchorY: 0.5, x: 2048 - 150, y: 2732 - 200 }); game.addChild(cardDeckIcon); drawCardBtn.setCallback(function () { if (gameState === GAME_STATE.PLAYER_TURN && playerHand.length < 5 && cardsInDeck > 0) { drawCard(); } }); // End turn button var endTurnBtn = new Button(); endTurnBtn.setText('End Turn'); endTurnBtn.x = 150; endTurnBtn.y = 2732 - 100; game.addChild(endTurnBtn); endTurnBtn.setCallback(function () { if (gameState === GAME_STATE.PLAYER_TURN) { endPlayerTurn(); } }); // Card deck initialization var cardTypes = [{ type: 'ability', name: 'Psychic Shield', description: 'Increase defense for 2 turns', power: 15, cost: 25 }, { type: 'weapon', name: 'Anomaly Neutralizer', description: 'Deal extra damage to anomalies', power: 30, cost: 40 }, { type: 'equipment', name: 'Energy Booster', description: 'Restore energy', power: 50, cost: 15 }, { type: 'ability', name: 'Containment Field', description: 'Trap anomalies for easy capture', power: 25, cost: 35 }, { type: 'weapon', name: 'Tactical Rifle', description: 'Medium range attack', power: 20, cost: 30 }, { // New card type type: 'land', name: 'Darkness Between Dimensions', description: 'Spawns a machine that, after a random amount of time, will transport anything nearby into the Darkness Between Dimensions. Players in the Darkness Between Dimensions can be saved by divine grace, or with the item “Scranton’s Grappling Hook”. After a random amount of time, players will be returned to the board. They will come back… squishier.', power: 0, cost: 0 }]; // Initialize game board function initBoard() { gameBoard = []; for (var y = 0; y < BOARD_SIZE; y++) { gameBoard[y] = []; for (var x = 0; x < BOARD_SIZE; x++) { gameBoard[y][x] = { entities: [], type: 'empty' }; } } } // Check if a tile is empty function isTileEmpty(x, y) { if (x < 0 || x >= BOARD_SIZE || y < 0 || y >= BOARD_SIZE) { return false; } // Check for any entities on this tile for (var i = 0; i < playerEntities.length; i++) { if (playerEntities[i].boardX === x && playerEntities[i].boardY === y) { return false; } } for (var i = 0; i < opponentEntities.length; i++) { if (opponentEntities[i].boardX === x && opponentEntities[i].boardY === y) { return false; } } for (var i = 0; i < anomalies.length; i++) { if (anomalies[i].boardX === x && anomalies[i].boardY === y) { return false; } } return true; } // Initialize player team function initPlayerTeam() { for (var i = 0; i < 2; i++) { var player = new Entity(); player.init({ type: 'player', name: 'SCP Agent ' + (i + 1), health: 150, maxHealth: 150, energy: 100, maxEnergy: 100, power: 25, moveRange: 3 }, true); player.boardX = i; player.boardY = 0; player.x = BOARD_OFFSET_X + player.boardX * TILE_SIZE + TILE_SIZE / 2; player.y = BOARD_OFFSET_Y + player.boardY * TILE_SIZE + TILE_SIZE / 2; game.addChild(player); playerEntities.push(player); } } // Initialize opponent team function initOpponents() { for (var i = 0; i < 2; i++) { var opponent = new Entity(); opponent.init({ type: 'opponent', name: 'Chaos Agent ' + (i + 1), health: 120, maxHealth: 120, energy: 100, maxEnergy: 100, power: 20, moveRange: 2 }); opponent.boardX = BOARD_SIZE - 1 - i; opponent.boardY = BOARD_SIZE - 1; opponent.x = BOARD_OFFSET_X + opponent.boardX * TILE_SIZE + TILE_SIZE / 2; opponent.y = BOARD_OFFSET_Y + opponent.boardY * TILE_SIZE + TILE_SIZE / 2; game.addChild(opponent); opponentEntities.push(opponent); } } // Initialize anomalies function initAnomalies() { // Create 4 anomalies for (var i = 0; i < 4; i++) { var anomaly = new Entity(); anomaly.init({ type: 'anomaly', name: 'SCP-' + (Math.floor(Math.random() * 899) + 100), health: 80, maxHealth: 80, energy: 50, maxEnergy: 50, power: 15, moveRange: 1 }); // Find a random empty position for the anomaly var randomX, randomY; do { randomX = Math.floor(Math.random() * BOARD_SIZE); randomY = Math.floor(Math.random() * BOARD_SIZE); } while (!isTileEmpty(randomX, randomY)); anomaly.boardX = randomX; anomaly.boardY = randomY; anomaly.x = BOARD_OFFSET_X + anomaly.boardX * TILE_SIZE + TILE_SIZE / 2; anomaly.y = BOARD_OFFSET_Y + anomaly.boardY * TILE_SIZE + TILE_SIZE / 2; game.addChild(anomaly); anomalies.push(anomaly); } } // Show movement highlights function showMovementHighlights() { if (!selectedEntity) { return; } clearHighlights(); var range = selectedEntity.moveRange; for (var y = 0; y < BOARD_SIZE; y++) { for (var x = 0; x < BOARD_SIZE; x++) { var dx = Math.abs(selectedEntity.boardX - x); var dy = Math.abs(selectedEntity.boardY - y); var dist = Math.max(dx, dy); if (dist <= range) { var highlight = new Highlight(); highlight.setPosition(x, y); game.addChild(highlight); highlights.push(highlight); } } } } // Clear highlights function clearHighlights() { for (var i = 0; i < highlights.length; i++) { highlights[i].destroy(); } highlights = []; } // Select an entity function selectEntity(entity) { // Deselect previous entity if (selectedEntity) { tween(selectedEntity, { scaleX: 1, scaleY: 1 }, { duration: 100, easing: tween.easeOut }); } // Select new entity selectedEntity = entity; if (selectedEntity) { tween(selectedEntity, { scaleX: 1.1, scaleY: 1.1 }, { duration: 100, easing: tween.easeOut }); showMovementHighlights(); } } // Draw a card function drawCard() { if (playerHand.length >= 5 || cardsInDeck <= 0) { return; } cardsInDeck--; drawCardBtn.setText('Draw Card (' + cardsInDeck + ')'); var cardType = cardTypes[Math.floor(Math.random() * cardTypes.length)]; var card = new Card(); card.init(cardType); card.x = 2048 / 2; card.y = 2732 - 150; // Position cards in hand var cardSpacing = 170; var handWidth = (playerHand.length + 1) * cardSpacing; var startX = (2048 - handWidth) / 2 + cardSpacing / 2; card.x = startX + playerHand.length * cardSpacing; game.addChild(card); playerHand.push(card); LK.getSound('cardDraw').play(); } // Use a card function cardSelected(card) { if (gameState !== GAME_STATE.PLAYER_TURN || !selectedEntity || !selectedEntity.isPlayer) { return; } // Apply card effect if (card.cardType === 'ability') { selectedEntity.restoreEnergy(card.power); } else if (card.cardType === 'weapon') { selectedEntity.power += card.power; // Temporary power boost LK.setTimeout(function () { selectedEntity.power -= card.power; }, 5000); } else if (card.cardType === 'equipment') { selectedEntity.heal(card.power); } else if (card.cardType === 'land') { // Move card to the board var boardX = Math.floor(selectedEntity.x / TILE_SIZE); var boardY = Math.floor(selectedEntity.y / TILE_SIZE); if (isTileEmpty(boardX, boardY)) { selectedEntity.moveToPosition(boardX, boardY); // Spawn a machine that transports nearby entities to the Darkness Between Dimensions var machine = new Entity(); machine.init({ type: 'machine', name: 'Dimensional Transporter', health: 100, maxHealth: 100, energy: 0, maxEnergy: 0, power: 0, moveRange: 0 }); machine.boardX = boardX; machine.boardY = boardY; machine.x = BOARD_OFFSET_X + machine.boardX * TILE_SIZE + TILE_SIZE / 2; machine.y = BOARD_OFFSET_Y + machine.boardY * TILE_SIZE + TILE_SIZE / 2; game.addChild(machine); // Transport entities after a random time LK.setTimeout(function () { transportEntitiesToDarkness(machine); }, Math.random() * 5000 + 2000); // Random time between 2 to 7 seconds } // Move card to the board var boardX = Math.floor(selectedEntity.x / TILE_SIZE); var boardY = Math.floor(selectedEntity.y / TILE_SIZE); if (isTileEmpty(boardX, boardY)) { selectedEntity.moveToPosition(boardX, boardY); // Spawn a machine that transports nearby entities to the Darkness Between Dimensions var machine = new Entity(); machine.init({ type: 'machine', name: 'Dimensional Transporter', health: 100, maxHealth: 100, energy: 0, maxEnergy: 0, power: 0, moveRange: 0 }); machine.boardX = boardX; machine.boardY = boardY; machine.x = BOARD_OFFSET_X + machine.boardX * TILE_SIZE + TILE_SIZE / 2; machine.y = BOARD_OFFSET_Y + machine.boardY * TILE_SIZE + TILE_SIZE / 2; game.addChild(machine); // Transport entities after a random time LK.setTimeout(function () { transportEntitiesToDarkness(machine); }, Math.random() * 5000 + 2000); // Random time between 2 to 7 seconds } } // Remove card from hand var index = playerHand.indexOf(card); if (index !== -1) { playerHand.splice(index, 1); card.destroy(); // Reorganize hand var cardSpacing = 170; var handWidth = playerHand.length * cardSpacing; var startX = (2048 - handWidth) / 2 + cardSpacing / 2; for (var i = 0; i < playerHand.length; i++) { tween(playerHand[i], { x: startX + i * cardSpacing }, { duration: 300, easing: tween.easeInOut }); } } } // Check for anomaly at position function checkForAnomalyAtPosition(x, y) { for (var i = 0; i < anomalies.length; i++) { if (anomalies[i].boardX === x && anomalies[i].boardY === y) { // Initiate containment var anomaly = anomalies[i]; // Lower health to make containment easier for demo anomaly.takeDamage(40); if (anomaly.health <= 0) { containAnomaly(anomaly); } } } } // Contain an anomaly function containAnomaly(anomaly) { LK.getSound('anomalyContain').play(); var index = anomalies.indexOf(anomaly); if (index !== -1) { anomalies.splice(index, 1); // Increase score score += 100; scoreTxt.setText('Score: ' + score); // Update stored anomaly count storage.containedAnomalies = (storage.containedAnomalies || 0) + 1; // Check if all anomalies are contained if (anomalies.length === 0) { // Win condition LK.setScore(score); if (score > storage.highScore) { storage.highScore = score; } LK.showYouWin(); } } } // End player turn function endPlayerTurn() { if (gameState !== GAME_STATE.PLAYER_TURN) { return; } gameState = GAME_STATE.OPPONENT_TURN; turnTxt.setText('Opponent Turn'); clearHighlights(); selectEntity(null); // Opponent turn timer LK.setTimeout(executeOpponentTurn, 1000); } // Execute opponent turn function executeOpponentTurn() { // Process each opponent for (var i = 0; i < opponentEntities.length; i++) { var opponent = opponentEntities[i]; // Find nearest target (player or anomaly) var target = null; var minDist = 999; // Check player entities for (var j = 0; j < playerEntities.length; j++) { var dx = Math.abs(opponent.boardX - playerEntities[j].boardX); var dy = Math.abs(opponent.boardY - playerEntities[j].boardY); var dist = dx + dy; if (dist < minDist) { minDist = dist; target = playerEntities[j]; } } // Take action based on distance if (target) { if (minDist <= 1) { // Attack if adjacent LK.setTimeout(function (attacker, defender) { return function () { attacker.attack(defender); }; }(opponent, target), 500 * i); } else { // Move toward target var moveX = opponent.boardX; var moveY = opponent.boardY; if (target.boardX > opponent.boardX) { moveX++; } else if (target.boardX < opponent.boardX) { moveX--; } if (target.boardY > opponent.boardY) { moveY++; } else if (target.boardY < opponent.boardY) { moveY--; } // Check if the tile is empty if (isTileEmpty(moveX, moveY)) { LK.setTimeout(function (entity, x, y) { return function () { entity.moveToPosition(x, y); }; }(opponent, moveX, moveY), 500 * i); } } } } // Process each anomaly (simple random movement) for (var i = 0; i < anomalies.length; i++) { var anomaly = anomalies[i]; // Random movement var directions = [{ x: 1, y: 0 }, { x: -1, y: 0 }, { x: 0, y: 1 }, { x: 0, y: -1 }]; var validMoves = []; for (var j = 0; j < directions.length; j++) { var moveX = anomaly.boardX + directions[j].x; var moveY = anomaly.boardY + directions[j].y; if (moveX >= 0 && moveX < BOARD_SIZE && moveY >= 0 && moveY < BOARD_SIZE && isTileEmpty(moveX, moveY)) { validMoves.push({ x: moveX, y: moveY }); } } if (validMoves.length > 0) { var randomMove = validMoves[Math.floor(Math.random() * validMoves.length)]; LK.setTimeout(function (entity, x, y) { return function () { entity.moveToPosition(x, y); }; }(anomaly, randomMove.x, randomMove.y), 1000 + 300 * i); } } // End opponent turn after all moves LK.setTimeout(startPlayerTurn, 2000); } // Start player turn function startPlayerTurn() { gameState = GAME_STATE.PLAYER_TURN; turnTxt.setText('Player Turn'); turnCounter++; if (turnCounter === 4) { spawnSupremeDivineBeings(); } // Restore energy for player entities for (var i = 0; i < playerEntities.length; i++) { playerEntities[i].restoreEnergy(20); } // Check game state checkGameState(); } // Check game state function checkGameState() { // Check if player is defeated if (playerEntities.length === 0) { LK.setScore(score); LK.showGameOver(); return; } // Check if all opponents are defeated if (opponentEntities.length === 0) { score += 500; scoreTxt.setText('Score: ' + score); LK.setScore(score); if (score > storage.highScore) { storage.highScore = score; } LK.showYouWin(); return; } // Check if maximum turns reached if (turnCounter >= 30) { LK.setScore(score); if (score > storage.highScore) { storage.highScore = score; } LK.showGameOver(); return; } } // Initialize game function initGame() { // Clear everything clearHighlights(); for (var i = 0; i < playerEntities.length; i++) { playerEntities[i].destroy(); } playerEntities = []; for (var i = 0; i < opponentEntities.length; i++) { opponentEntities[i].destroy(); } opponentEntities = []; for (var i = 0; i < anomalies.length; i++) { anomalies[i].destroy(); } anomalies = []; for (var i = 0; i < playerHand.length; i++) { playerHand[i].destroy(); } playerHand = []; // Setup variables score = 0; scoreTxt.setText('Score: ' + score); turnCounter = 0; gameState = GAME_STATE.SETUP; selectedEntity = null; cardsInDeck = 20; drawCardBtn.setText('Draw Card (' + cardsInDeck + ')'); // Initialize game elements initBoard(); // Function to change the game mode function changeGameMode(mode) { if (gameModes[mode]) { selectedGameMode = gameModes[mode]; selectedGameMode.init(); } else { console.error("Invalid game mode selected"); } } // Select game mode var selectedGameMode = gameModes.standard; // Default game mode selectedGameMode.init(); // Start game gameState = GAME_STATE.PLAYER_TURN; turnTxt.setText('Player Turn'); // Draw initial cards for (var i = 0; i < 3; i++) { drawCard(); } // Play background music LK.playMusic('bgmusic', { loop: true }); } // Game navigation game.down = function (x, y, obj) { // Empty handler for board clicks not handled by entities }; game.move = function (x, y, obj) { // Empty handler for mouse movement }; // Main game loop game.update = function () { // Initialize game if we're in setup if (gameState === GAME_STATE.SETUP) { initGame(); } }; // Start the game initGame();
===================================================================
--- original.js
+++ change.js
@@ -900,8 +900,35 @@
LK.setTimeout(function () {
transportEntitiesToDarkness(machine);
}, Math.random() * 5000 + 2000); // Random time between 2 to 7 seconds
}
+ // Move card to the board
+ var boardX = Math.floor(selectedEntity.x / TILE_SIZE);
+ var boardY = Math.floor(selectedEntity.y / TILE_SIZE);
+ if (isTileEmpty(boardX, boardY)) {
+ selectedEntity.moveToPosition(boardX, boardY);
+ // Spawn a machine that transports nearby entities to the Darkness Between Dimensions
+ var machine = new Entity();
+ machine.init({
+ type: 'machine',
+ name: 'Dimensional Transporter',
+ health: 100,
+ maxHealth: 100,
+ energy: 0,
+ maxEnergy: 0,
+ power: 0,
+ moveRange: 0
+ });
+ machine.boardX = boardX;
+ machine.boardY = boardY;
+ machine.x = BOARD_OFFSET_X + machine.boardX * TILE_SIZE + TILE_SIZE / 2;
+ machine.y = BOARD_OFFSET_Y + machine.boardY * TILE_SIZE + TILE_SIZE / 2;
+ game.addChild(machine);
+ // Transport entities after a random time
+ LK.setTimeout(function () {
+ transportEntitiesToDarkness(machine);
+ }, Math.random() * 5000 + 2000); // Random time between 2 to 7 seconds
+ }
}
// Remove card from hand
var index = playerHand.indexOf(card);
if (index !== -1) {
Healthbar. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Player. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Opponent. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
EnergyBar. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Board. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Anomaly. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Button. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
animal. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
SCP. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
SCP card. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
anomalyneutralizer card. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
containmentfield card. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
cardFront. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
barBackground. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
darknessbetweendimensions. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
manual. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
moneyCounterDisplay. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Wondertainment product. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
EndTurnButton. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
randomscp. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Attack. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Containment. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
White Card called “Panacea” which was used to heal. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
modified Colt AR-15. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
giant flaming angel's sword. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
hidden golden anomaly. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Orangutan. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows