User prompt
Generate the 9th version of the source code of my game: SCP-3301
User prompt
Generate the 8th version of the source code of my game: SCP-3301
User prompt
Generate the 7th version of the source code of my game: SCP-3301
User prompt
Generate the 6th version of the source code of my game: SCP-3301
User prompt
Generate the 5th version of the source code of my game: SCP-3301
User prompt
Generate the fourth version of the source code of my game: SCP-3301
User prompt
Generate the 4th version of the source code of my game: SCP-3301
User prompt
Please fix the bug: 'undefined is not an object (evaluating 'playerStats.HP')' in or related to this line: 'var percent = Math.max(0, Math.min(1, playerStats.HP / 10));' Line Number: 109
User prompt
Generate the third version of the source code of my game: SCP-3301
User prompt
Generate the second version of the source code of my game: SCP-3301
User prompt
Generate the first version of the source code of my game: SCP-3301
User prompt
Generate the third version of the source code of my game: SCP-3301 ↪💡 Consider importing and using the following plugins: @upit/tween.v1, @upit/storage.v1
User prompt
Generate the first version of the source code of my game: SCP-3301 ↪💡 Consider importing and using the following plugins: @upit/tween.v1, @upit/storage.v1 ↪💡 Consider importing and using the following plugins: @upit/tween.v1, @upit/storage.v1
User prompt
add: Card Color: Red Card Title: The Nerfing Gun Subtitle: A low effort pun Type: Weapon, Ranged Description: A fancy Nerf gun that makes everything worse. Excels at ethically questionable humanoid transfiguration. Expires after one use. Stats: Transfiguration Attack / - 10 ACC
User prompt
Agent Shaw recovered enough to use her red card "The Nerfing Gun" to transform Spc. Thompson into an Orangutan. this can happen to anyone
User prompt
add: hidden golden anomaly
User prompt
add weapon: giant flaming angel's sword
User prompt
add weapon: modified Colt AR-15
User prompt
add: White Card called “Panacea” which was used to heal
User prompt
Add: Containment
User prompt
Please fix the bug: 'self.updateBars is not a function. (In 'self.updateBars()', 'self.updateBars' is undefined)' in or related to this line: 'self.updateBars();' Line Number: 390
User prompt
Remove 'self.updateBars is not a function. (In 'self.updateBars()', 'self.updateBars' is undefined)' in or related to this line: 'self.updateBars();' Line Number: 390
User prompt
Please fix the bug: 'self.updateBars is not a function. (In 'self.updateBars()', 'self.updateBars' is undefined)' in or related to this line: 'self.updateBars();' Line Number: 390
User prompt
Remove updatebars
User prompt
Please fix the bug: 'undefined is not an object (evaluating 'self.updateBars = function () { __$(796); var healthPercent = self.health / self.maxHealth; __$(797); var energyPercent = self.energy / self.maxEnergy; __$(798); self.healthBar.width = 60 * healthPercent; __$(799); self.energyBar.width = 60 * energyPercent; }')' in or related to this line: 'self.updateBars = function () {' Line Number: 1578
/**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ // --- SCP-3301: Initial Board, Player, and Card Draw Logic --- // Board setup var board = LK.getAsset('board', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 }); game.addChild(board); // Player piece setup var playerPiece = LK.getAsset('player', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 - 300 }); game.addChild(playerPiece); // Card hand setup var hand = []; var maxHandSize = 10; var initialHandSize = 7; // Card draw function function drawCard() { // For now, just use a generic card back as a placeholder var card = LK.getAsset('cardBack', { anchorX: 0.5, anchorY: 0.5 }); hand.push(card); return card; } // Draw initial hand for (var i = 0; i < initialHandSize; i++) { var card = drawCard(); // Display cards in a fan at the bottom of the screen card.x = 2048 / 2 - (initialHandSize - 1) * 60 / 2 + i * 60; card.y = 2732 - 120; game.addChild(card); } // End turn button var endTurnBtn = LK.getAsset('EndTurnButton', { anchorX: 0.5, anchorY: 0.5, x: 2048 - 200, y: 2732 - 120 }); game.addChild(endTurnBtn); // Draw card at end of turn, discard if over max hand size endTurnBtn.down = function (x, y, obj) { if (hand.length < maxHandSize) { var card = drawCard(); card.x = 2048 / 2 - (initialHandSize - 1) * 60 / 2 + (hand.length - 1) * 60; card.y = 2732 - 120; game.addChild(card); } else { // Discard the last card if over max hand size var discarded = hand.pop(); discarded.destroy(); } }; // Money counter (yellow cards effect) var moneyCounter = LK.getAsset('moneyCounterDisplay', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 80 }); game.addChild(moneyCounter); var moneyValue = 10000; var moneyText = new Text2('$' + moneyValue, { size: 80, fill: 0xFFFF00 }); moneyText.anchor.set(0.5, 0.5); moneyText.x = 2048 / 2; moneyText.y = 80; LK.gui.top.addChild(moneyText); // Update money display function function updateMoney(val) { moneyValue = val; moneyText.setText('$' + moneyValue); } // Placeholder for future: draw card types, entity spawn, and win conditions // --- End SCP-3301 initial setup ---
===================================================================
--- original.js
+++ change.js
@@ -1,1528 +1,94 @@
/****
-* 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) {
- var event = obj.event; // Use the event object provided
- tween(self, {
- scaleX: 0.95,
- scaleY: 0.95
- }, {
- duration: 100,
- easing: tween.easeOut
- });
- };
- self.up = function (x, y, obj) {
- var event = obj.event; // Use the event object provided
- 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) {
- var event = obj.event; // Use the event object provided
- tween(self, {
- scaleX: 1.1,
- scaleY: 1.1
- }, {
- duration: 100,
- easing: tween.easeOut
- });
- };
- self.up = function (x, y, obj) {
- var event = obj.event; // Use the event object provided
- tween(self, {
- scaleX: 1,
- scaleY: 1
- }, {
- duration: 100,
- easing: tween.easeOut
- });
- if (!self.revealed) {
- self.reveal();
- LK.getSound('cardDraw').play();
- }
- // Trigger card selection in the game
- if (typeof cardSelected === 'function') {
- cardSelected(self);
- }
- };
- return self;
-});
-var EnemyBullet = Container.expand(function () {
- var self = Container.call(this);
- var bulletGraphics = self.attachAsset('enemyBullet', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.speed = 5;
- self.update = function () {
- self.y += self.speed;
- };
-});
-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);
- self.healthText = new Text2('', {
- size: 14,
- fill: 0xFF0000
- });
- self.healthText.anchor.set(0.5, 0);
- self.healthText.y = -70;
- self.addChild(self.healthText);
- self.energyText = new Text2('', {
- size: 14,
- fill: 0x0000FF
- });
- self.energyText.anchor.set(0.5, 0);
- self.energyText.y = -85;
- self.addChild(self.energyText);
- // Initialize entity with data
- self.init = function (data, isPlayerEntity) {
- self.entityType = data.type;
- self.health = data.health || (data.card ? data.card.power : 100);
- self.maxHealth = data.maxHealth || (data.card ? data.card.power : self.health);
- self.maxEnergy = data.maxEnergy || (data.card ? data.card.cost : self.energy);
- self.energy = data.energy || (data.card ? data.card.cost : 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.healthBar = self.attachAsset('healthBar', {
- anchorX: 0,
- anchorY: 0.5,
- x: -30,
- y: -45
- });
- self.energyBar = self.attachAsset('energyBar', {
- anchorX: 0,
- anchorY: 0.5,
- x: -30,
- y: -35
- });
- self.updateBars = function () {
- var healthPercent = self.health / self.maxHealth;
- var energyPercent = self.energy / self.maxEnergy;
- self.healthBar.width = self.maxHealth * healthPercent;
- self.energyBar.width = self.maxEnergy * energyPercent;
- self.healthText.setText('HP: ' + self.health + '/' + self.maxHealth);
- self.energyText.setText('EN: ' + self.energy + '/' + self.maxEnergy);
- };
- // Removed call to undefined updateBars function
- self.healthText.setText('HP: ' + self.health + '/' + self.maxHealth);
- self.energyText.setText('EN: ' + self.energy + '/' + self.maxEnergy);
- };
- // Update health and energy bars
- // 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();
- // Handle secondary player death and reappearance
- if (self.isPlayer) {
- console.log("Secondary player has died and will reappear outside the distortion");
- }
- 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 HeroBullet = Container.expand(function () {
- var self = Container.call(this);
- var bulletGraphics = self.attachAsset('heroBullet', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.speed = -5;
- self.update = function () {
- self.y += self.speed;
- };
-});
-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;
-});
-var MoneyCounter = Container.expand(function () {
- var self = Container.call(this);
- self.text = new Text2('Money: $0', {
- size: 40,
- fill: 0xFFFF00
- });
- self.text.anchor.set(0.5, 0);
- self.addChild(self.text);
- self.updateDisplay = function (amount) {
- self.text.setText('Money: $' + amount);
- };
- return self;
-});
-var NewObject = Container.expand(function () {
- var self = Container.call(this);
- // Object properties
- self.objectType = 'newObject';
- self.health = 100;
- self.maxHealth = 100;
- self.energy = 50;
- self.maxEnergy = 50;
- self.power = 20;
- self.moveRange = 2;
- // Object visuals
- self.graphic = self.attachAsset('RandomObject', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- // Initialize object with data
- self.init = function (data) {
- self.objectType = data.type || self.objectType;
- self.health = data.health || self.health;
- self.maxHealth = data.maxHealth || self.maxHealth;
- self.energy = data.energy || self.energy;
- self.maxEnergy = data.maxEnergy || self.maxEnergy;
- self.power = data.power || self.power;
- self.moveRange = data.moveRange || self.moveRange;
- };
- // Update health and energy bars
- // 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);
- };
- // 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();
- }
- });
- };
- return self;
-});
-var RandomOpponent = Container.expand(function () {
- var self = Container.call(this);
- self.init = function () {
- self.entityType = 'randomOpponent';
- self.health = Math.floor(Math.random() * 100) + 50;
- self.maxHealth = self.card ? self.card.power : self.health;
- self.maxEnergy = self.card ? self.card.cost : self.energy;
- self.energy = Math.floor(Math.random() * 50) + 50;
- if (self.card) {
- self.health = self.card.power;
- self.maxHealth = self.health;
- self.energy = self.card.cost;
- self.maxEnergy = self.energy;
- }
- self.power = Math.floor(Math.random() * 20) + 10;
- self.moveRange = Math.floor(Math.random() * 3) + 1;
- self.graphic = self.attachAsset('RandomOpponent', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.updateBars = function () {
- if (!self.healthBar) {
- self.healthBar = self.attachAsset('healthBar', {
- anchorX: 0,
- anchorY: 0.5,
- x: -30,
- y: -45
- });
- }
- if (!self.energyBar) {
- self.energyBar = self.attachAsset('energyBar', {
- anchorX: 0,
- anchorY: 0.5,
- x: -30,
- y: -35
- });
- }
- var healthPercent = self.health / self.maxHealth;
- var energyPercent = self.energy / self.maxEnergy;
- self.healthBar.width = 60 * healthPercent;
- self.energyBar.width = 60 * energyPercent;
- self.lastHealth = self.health; // Initialize lastHealth
- self.lastEnergy = self.energy; // Initialize lastEnergy
- };
- self.updateBars(); // Ensure updateBars is called after initialization
- self.updateBars(); // Ensure updateBars is called after initialization
- self.updateBars(); // Ensure updateBars is called after initialization
- self.updateBars(); // Ensure updateBars is called after initialization
- self.updateBars(); // Ensure updateBars is called after initialization
- self.updateBars(); // Ensure updateBars is called after initialization
- self.updateBars(); // Ensure updateBars is called after initialization
- self.updateBars(); // Ensure updateBars is called after initialization
- self.updateBars(); // Ensure updateBars is called after initialization
- self.updateBars(); // Ensure updateBars is called after initialization
- self.updateBars(); // Ensure updateBars is called after initialization
- self.updateBars(); // Ensure updateBars is called after initialization
- self.healthBar = self.attachAsset('healthBar', {
- anchorX: 0,
- anchorY: 0.5,
- x: -30,
- y: -45
- });
- self.energyBar = self.attachAsset('energyBar', {
- anchorX: 0,
- anchorY: 0.5,
- x: -30,
- y: -35
- });
- self.updateBars();
- };
- return self;
-});
-var RandomSCP = Container.expand(function () {
- var self = Container.call(this);
- self.init = function () {
- self.entityType = 'randomSCP';
- self.health = Math.floor(Math.random() * 100) + 50;
- self.maxHealth = self.card ? self.card.power : self.health;
- self.maxEnergy = self.card ? self.card.cost : self.energy;
- self.energy = Math.floor(Math.random() * 50) + 50;
- if (self.card) {
- self.health = self.card.power;
- self.maxHealth = self.health;
- self.energy = self.card.cost;
- self.maxEnergy = self.energy;
- }
- self.power = Math.floor(Math.random() * 20) + 10;
- self.moveRange = Math.floor(Math.random() * 3) + 1;
- self.graphic = self.attachAsset('RandomSCP', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.updateBars = function () {
- if (!self.healthBar) {
- self.healthBar = self.attachAsset('healthBar', {
- anchorX: 0,
- anchorY: 0.5,
- x: -30,
- y: -45
- });
- }
- if (!self.energyBar) {
- self.energyBar = self.attachAsset('energyBar', {
- anchorX: 0,
- anchorY: 0.5,
- x: -30,
- y: -35
- });
- }
- var healthPercent = self.health / self.maxHealth;
- var energyPercent = self.energy / self.maxEnergy;
- self.healthBar.width = 60 * healthPercent;
- self.energyBar.width = 60 * energyPercent;
- self.lastHealth = self.health; // Initialize lastHealth
- self.lastEnergy = self.energy; // Initialize lastEnergy
- };
- self.updateBars(); // Ensure updateBars is called after initialization
- self.updateBars(); // Ensure updateBars is called after initialization
- self.updateBars(); // Ensure updateBars is called after initialization
- self.updateBars(); // Ensure updateBars is called after initialization
- self.updateBars(); // Ensure updateBars is called after initialization
- self.updateBars(); // Ensure updateBars is called after initialization
- self.updateBars(); // Ensure updateBars is called after initialization
- self.updateBars(); // Ensure updateBars is called after initialization
- self.updateBars(); // Ensure updateBars is called after initialization
- self.updateBars(); // Ensure updateBars is called after initialization
- self.updateBars(); // Ensure updateBars is called after initialization
- self.updateBars(); // Ensure updateBars is called after initialization
- self.updateBars(); // Ensure updateBars is called after initialization
- self.updateBars(); // Ensure updateBars is called after initialization
- self.updateBars(); // Ensure updateBars is called after initialization
- self.updateBars(); // Ensure updateBars is called after initialization
- self.updateBars(); // Ensure updateBars is called after initialization
- self.updateBars(); // Ensure updateBars is called after initialization
- self.updateBars(); // Ensure updateBars is called after initialization
- };
- return self;
-});
-
-/****
* Initialize Game
****/
var game = new LK.Game({
- // No title, no description
- // Always backgroundColor is black
backgroundColor: 0x000000
});
/****
* Game Code
****/
-function transformToOrangutan(entity) {
- entity.graphic = entity.attachAsset('Orangutan', {
+// --- SCP-3301: Initial Board, Player, and Card Draw Logic ---
+// Board setup
+var board = LK.getAsset('board', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 2048 / 2,
+ y: 2732 / 2
+});
+game.addChild(board);
+// Player piece setup
+var playerPiece = LK.getAsset('player', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 2048 / 2,
+ y: 2732 - 300
+});
+game.addChild(playerPiece);
+// Card hand setup
+var hand = [];
+var maxHandSize = 10;
+var initialHandSize = 7;
+// Card draw function
+function drawCard() {
+ // For now, just use a generic card back as a placeholder
+ var card = LK.getAsset('cardBack', {
anchorX: 0.5,
anchorY: 0.5
});
- entity.entityType = 'orangutan';
- entity.power = 5; // Reduced power for Orangutan
- entity.moveRange = 1; // Reduced move range for Orangutan
- console.log(entity.nameText.getText() + " has been transformed into an Orangutan!");
+ hand.push(card);
+ return card;
}
-// Game rules as described in the manual
-var gameRules = ["No hits below the belt.", "Targeting will result in a 15 yard penalty and a loss of downs.", "Drink your Ovaltine.", "Suspend your disbelief a little bit.", "This isn’t a game for children, so kids who play it are really cool.", "Leave your loyalties at the door.", "Buy Wondertainment products."];
-// Discard a card from the player's hand
-function discardCard() {
- if (playerHand.length > 0) {
- var card = playerHand.pop();
- card.destroy();
- }
+// Draw initial hand
+for (var i = 0; i < initialHandSize; i++) {
+ var card = drawCard();
+ // Display cards in a fan at the bottom of the screen
+ card.x = 2048 / 2 - (initialHandSize - 1) * 60 / 2 + i * 60;
+ card.y = 2732 - 120;
+ game.addChild(card);
}
-// Draw a card for the opponent
-function drawOpponentCard() {
- if (opponentHand.length >= 5 || cardsInDeck <= 0) {
- return;
+// End turn button
+var endTurnBtn = LK.getAsset('EndTurnButton', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 2048 - 200,
+ y: 2732 - 120
+});
+game.addChild(endTurnBtn);
+// Draw card at end of turn, discard if over max hand size
+endTurnBtn.down = function (x, y, obj) {
+ if (hand.length < maxHandSize) {
+ var card = drawCard();
+ card.x = 2048 / 2 - (initialHandSize - 1) * 60 / 2 + (hand.length - 1) * 60;
+ card.y = 2732 - 120;
+ game.addChild(card);
+ } else {
+ // Discard the last card if over max hand size
+ var discarded = hand.pop();
+ discarded.destroy();
}
- cardsInDeck--;
- var cardType = cardTypes[Math.floor(Math.random() * cardTypes.length)];
- var card = new Card();
- card.init(cardType);
- opponentHand.push(card);
-}
-// Game constants
-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
};
-// Money counter
-var moneyCounter = typeof storage.moneyCounter === "number" ? storage.moneyCounter : 0;
-var moneyCounterDisplay; // Define moneyCounterDisplay in the global scope
-// 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 = []; // Initialize player card hand in global scope
-var opponentHand = []; // Initialize opponent card hand in global scope
-var cardsInDeck = 20;
-// Game board and UI
-var boardGraphic = game.addChild(LK.getAsset('board', {
+// Money counter (yellow cards effect)
+var moneyCounter = LK.getAsset('moneyCounterDisplay', {
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
+ y: 80
});
-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
+game.addChild(moneyCounter);
+var moneyValue = 10000;
+var moneyText = new Text2('$' + moneyValue, {
+ size: 80,
+ fill: 0xFFFF00
});
-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);
-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
-}, {
- type: 'ability',
- name: 'Panacea',
- description: 'Heals the player completely',
- power: 100,
- cost: 50
-}, {
- type: 'weapon',
- name: 'Modified Colt AR-15',
- description: 'High damage assault rifle',
- power: 40,
- cost: 35
-}, {
- type: 'weapon',
- name: "Giant Flaming Angel's Sword",
- description: 'A powerful sword engulfed in flames',
- power: 60,
- cost: 50
-}, {
- type: 'weapon',
- name: 'The Nerfing Gun',
- description: 'A fancy Nerf gun that makes everything worse. Excels at ethically questionable humanoid transfiguration. Expires after one use.',
- power: 'Transfiguration Attack',
- cost: -10
-}];
-// Initialize game board
-function initBoard() {
- gameBoard = [];
- // Randomly select a board setting
- var boardSettings = ['The Land of the Unclean', 'Echoes of the Mariana', 'Bigfoot’s Jungle', 'The Cosmic Starfish'];
- var selectedSetting = boardSettings[Math.floor(Math.random() * boardSettings.length)];
- console.log("Selected Board Setting: " + selectedSetting);
- for (var y = 0; y < BOARD_SIZE; y++) {
- gameBoard[y] = [];
- for (var x = 0; x < BOARD_SIZE; x++) {
- gameBoard[y][x] = {
- entities: [],
- type: 'empty'
- };
- }
- }
- // Initialize hostile entities based on the selected setting
- initHostileEntities(selectedSetting);
+moneyText.anchor.set(0.5, 0.5);
+moneyText.x = 2048 / 2;
+moneyText.y = 80;
+LK.gui.top.addChild(moneyText);
+// Update money display function
+function updateMoney(val) {
+ moneyValue = val;
+ moneyText.setText('$' + moneyValue);
}
-// 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 entity
-function initPlayerEntity() {
- // Initialize primary players and their representatives
- 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 entities
-function initOpponents() {
- // Create 2 random opponents
- for (var i = 0; i < 2; i++) {
- var opponent = new RandomOpponent();
- opponent.init();
- // Place opponents on the opposite side
- 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, 1 Wondertainment product, and 1 hidden golden anomaly
- for (var i = 0; i < 6; i++) {
- var anomaly = new Entity();
- if (i === 4) {
- anomaly.init({
- type: 'wondertainment',
- name: 'Wondertainment Product',
- health: 50,
- maxHealth: 50,
- energy: 30,
- maxEnergy: 30,
- power: 10,
- moveRange: 1
- });
- } else if (i === 5) {
- anomaly.init({
- type: 'hiddenGoldenAnomaly',
- name: 'Hidden Golden Anomaly',
- health: 100,
- maxHealth: 100,
- energy: 60,
- maxEnergy: 60,
- power: 20,
- moveRange: 2
- });
- 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') {
- if (card.cardName === "The Nerfing Gun") {
- transformToOrangutan(selectedEntity);
- } else {
- selectedEntity.power += card.power;
- // Temporary power boost
- LK.setTimeout(function () {
- selectedEntity.power -= card.power;
- }, 5000);
- }
- } else if (card.cardType === 'equipment') {
- selectedEntity.heal(card.power);
- }
- // 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) {
- if (anomaly.entityType === 'wondertainment') {
- console.log("Collected a Wondertainment product!");
- playerEntities[0].hasContainedWondertainmentProduct = true;
- console.log("All the money goes to Wondertainment Products");
- }
- // Increase money counter when an anomaly is contained
- moneyCounter += 50;
- storage.moneyCounter = moneyCounter;
- moneyCounterDisplay.updateDisplay(moneyCounter);
- containAnomaly(anomaly);
- }
- }
- }
-}
-// Contain an anomaly
-function containAnomaly(anomaly) {
- LK.getSound('anomalyContain').play();
- var index = anomalies.indexOf(anomaly);
- if (index !== -1) {
- anomalies.splice(index, 1);
- // Play containment field effect
- var containmentField = LK.getAsset('containmentfield', {
- anchorX: 0.5,
- anchorY: 0.5,
- x: anomaly.x,
- y: anomaly.y
- });
- game.addChild(containmentField);
- tween(containmentField, {
- alpha: 0
- }, {
- duration: 1000,
- easing: tween.easeOut,
- onFinish: function onFinish() {
- containmentField.destroy();
- }
- });
- // 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;
- }
- // Draw a card at the end of the turn
- drawCard();
- // Discard if more than 10 cards
- if (playerHand.length > 10) {
- discardCard();
- }
- 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++;
- // 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 all anomalies are contained
- // Check for MR. SURVIVOR victory condition
- if (playerEntities.length === 1 && !playerEntities[0].hasMetOtherWinConditions) {
- console.log("Victory Condition: MR. SURVIVOR");
- LK.showYouWin();
- return;
- }
- // Check for MR. FOUNDATION victory condition
- if (playerEntities.some(function (player) {
- return player.hasContainedAllEntitiesAndPlayers;
- })) {
- console.log("Victory Condition: MR. FOUNDATION");
- LK.showYouWin();
- return;
- }
- // Check for MR. CONTAINMENT victory condition
- if (playerEntities.some(function (player) {
- return player.hasContainedMajorityAnomalies;
- })) {
- console.log("Victory Condition: MR. CONTAINMENT");
- LK.showYouWin();
- return;
- }
- // Check for MR. COALITION victory condition
- if (playerEntities.some(function (player) {
- return player.hasDestroyedMajorityAnomalies;
- })) {
- console.log("Victory Condition: MR. COALITION");
- LK.showYouWin();
- return;
- }
- // Check for MR. ESCHATOLOGY victory condition
- if (playerEntities.some(function (player) {
- return player.hasSummonedThreeSupremeDivineBeings;
- })) {
- console.log("Victory Condition: MR. ESCHATOLOGY");
- LK.showYouWin();
- return;
- }
- // Check for MR. GENOCIDE victory condition
- if (playerEntities.some(function (player) {
- return player.hasKilledAllPlayers;
- })) {
- console.log("Victory Condition: MR. GENOCIDE");
- LK.showYouWin();
- return;
- }
- // Check for MR. COLLECTOR victory condition
- if (playerEntities.some(function (player) {
- return player.hasContainedWondertainmentProduct;
- })) {
- console.log("Victory Condition: MR. COLLECTOR");
- LK.showYouWin();
- return;
- }
- // Check for MR. FINDER victory condition
- if (playerEntities.some(function (player) {
- return player.hasFoundAnomalousItem;
- })) {
- console.log("Victory Condition: MR. FINDER");
- LK.showYouWin();
- return;
- }
- 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 = [];
- for (var i = 0; i < opponentHand.length; i++) {
- opponentHand[i].destroy();
- }
- opponentHand = [];
- // Reset money counter
- moneyCounter = typeof storage.moneyCounter === "number" ? storage.moneyCounter : 0;
- if (moneyCounterDisplay) {
- moneyCounterDisplay.updateDisplay(moneyCounter);
- }
- // Setup variables
- score = 0;
- scoreTxt.setText('Score: ' + score);
- turnCounter = 0;
- gameState = GAME_STATE.SETUP;
- selectedEntity = null;
- cardsInDeck = 20;
- drawCardBtn.setText('Draw Card (' + cardsInDeck + ')');
- // Add money counter display
- moneyCounterDisplay = new MoneyCounter();
- moneyCounterDisplay.x = 2048 / 2;
- moneyCounterDisplay.y = 150;
- LK.gui.top.addChild(moneyCounterDisplay);
- // Initialize game elements
- initBoard();
- initPlayerEntity();
- initOpponents();
- initAnomalies();
- // Add spatial distortion effect
- console.log("Applying spatial distortion effect to the game area");
- // Start game
- gameState = GAME_STATE.PLAYER_TURN;
- turnTxt.setText('Player Turn');
- // Draw initial cards for player and opponent
- for (var i = 0; i < 7; i++) {
- drawCard();
- drawOpponentCard();
- }
- // 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();
-function initHostileEntities(setting) {
- switch (setting) {
- case 'The Land of the Unclean':
- // Initialize specific entities for this setting
- console.log("Initializing entities for The Land of the Unclean");
- break;
- case 'Echoes of the Mariana':
- // Initialize specific entities for this setting
- console.log("Initializing entities for Echoes of the Mariana");
- break;
- case 'Bigfoot’s Jungle':
- // Initialize specific entities for this setting
- console.log("Initializing entities for Bigfoot’s Jungle");
- break;
- case 'The Cosmic Starfish':
- // Initialize specific entities for this setting
- console.log("Initializing entities for The Cosmic Starfish");
- break;
- default:
- console.log("Unknown setting");
- }
-}
\ No newline at end of file
+// Placeholder for future: draw card types, entity spawn, and win conditions
+// --- End SCP-3301 initial setup ---
\ No newline at end of file
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