User prompt
make sure the cheater is always at least 0.5 away from the screen's perimeters
User prompt
Make score and countdown switch locations on screen
User prompt
Game also finishes when countdown reaches 0
User prompt
move the countdown to the top right corner
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'addChild')' in this line: 'LK.gui.bottomCenter.addChild(countdownTxt);' Line Number: 106
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'addChild')' in this line: 'LK.gui.bottomCenter.addChild(countdownTxt);' Line Number: 106
User prompt
exibit countdown
User prompt
set a count down of 5 seconds that renews every time the cheater is clicked on
User prompt
add 1 extra betting table for every 15 points
User prompt
make sure the cheater never spawns at the same spot of the badge
User prompt
add 5 more gamblers for every 10 points
User prompt
increase the speed of gamblers
User prompt
change the location of the betting tables every 5 seconds
User prompt
add 5 extra genuine gamblers
var CasinoFloor = Container.expand(function () { var self = Container.call(this); var floorGraphics = self.createAsset('casinoFloor', 'Casino Floor Background', 0, 0); floorGraphics.width = 2048; floorGraphics.height = 2732; self.addChild(floorGraphics); self.bettingTables = []; for (var i = 0; i < 5; i++) { var table = self.createAsset('bettingTable', 'Betting Table', 0.5, 0.5); table.x = Math.random() * (2048 - table.width) + table.width / 2; table.y = Math.random() * (2732 - table.height) + table.height / 2; self.bettingTables.push(table); self.addChild(table); } self.repositionTables = function () { for (var i = 0; i < self.bettingTables.length; i++) { var table = self.bettingTables[i]; table.x = Math.random() * (2048 - table.width) + table.width / 2; table.y = Math.random() * (2732 - table.height) + table.height / 2; } }; }); var HealthBar = Container.expand(function () { var self = Container.call(this); self.tries = 3; self.healthGraphics = []; for (var i = 0; i < self.tries; i++) { var badge = self.createAsset('badge', 'Security Badge', 0, 0); badge.x = i * (badge.width + 10); self.healthGraphics.push(badge); self.addChild(badge); } self.removeTry = function () { if (self.tries > 0) { self.tries--; var heart = self.healthGraphics.pop(); heart.destroy(); } }; self.isGameOver = function () { return self.tries <= 0; }; }); var Gambler = Container.expand(function () { var self = Container.call(this); var gamblerGraphics = self.createAsset('gambler', 'Genuine Gambler', .5, .5); self.isCheater = false; self.targetTable = null; self.speed = 6; self.move = function (bettingTables) { if (!self.targetTable) { self.targetTable = bettingTables[Math.floor(Math.random() * bettingTables.length)]; } var dx = self.targetTable.x - self.x; var dy = self.targetTable.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > self.speed) { self.x += dx / distance * self.speed; self.y += dy / distance * self.speed; } else { self.targetTable = null; } }; }); var Cheater = Gambler.expand(function () { var self = Container.call(this); var gamblerGraphics = self.createAsset('cheater', 'Cheating Gambler', .5, .5); self.isCheater = true; }); var Game = Container.expand(function () { var self = Container.call(this); self.addGamblers = function () { for (var i = 0; i < 5; i++) { var gambler = new Gambler(); gambler.x = Math.random() * 2048; gambler.y = Math.random() * 2732; self.addChild(gambler); gamblers.push(gambler); gambler.on('down', function (obj) { healthBar.removeTry(); if (healthBar.isGameOver()) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } }); } }; function respawnCheater(cheater) { do { cheater.x = Math.random() * 2048; cheater.y = Math.random() * 2732; } while (healthBar.healthGraphics.some(function (badge) { return cheater.intersects(badge); })); } var gamblers = []; var cheaters = []; var score = 0; var scoreTxt; var cheaterClickCountdown = 5000; var countdownTxt = new Text2('5', { size: 150, fill: "#ffffff" }); countdownTxt.anchor.set(1, 0); LK.gui.topRight.addChild(countdownTxt); var casinoFloor = new CasinoFloor(); self.addChild(casinoFloor); var healthBar = new HealthBar(); LK.gui.topLeft.addChild(healthBar); scoreTxt = new Text2('0', { size: 150, fill: "#ffffff" }); scoreTxt.anchor.set(.5, 0); LK.gui.topCenter.addChild(scoreTxt); self.addBettingTable = function () { if (score % 15 === 0 && score !== 0) { var table = casinoFloor.createAsset('bettingTable', 'Betting Table', 0.5, 0.5); table.x = Math.random() * (2048 - table.width) + table.width / 2; table.y = Math.random() * (2732 - table.height) + table.height / 2; casinoFloor.bettingTables.push(table); casinoFloor.addChild(table); } }; for (var i = 0; i < 15; i++) { var gambler = new Gambler(); gambler.x = Math.random() * 2048; gambler.y = Math.random() * 2732; self.addChild(gambler); gamblers.push(gambler); gambler.on('down', function (obj) { healthBar.removeTry(); if (healthBar.isGameOver()) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } }); if (i < 1) { var cheater = new Cheater(); cheater.x = Math.random() * 2048; cheater.y = Math.random() * 2732; self.addChild(cheater); cheaters.push(cheater); cheater.on('down', function () { score += 1; scoreTxt.setText(score); self.addBettingTable(); if (score % 10 === 0) { self.addGamblers(); } respawnCheater(this); cheaterClickCountdown = 5000; }); } } LK.on('tick', function () { for (var i = 0; i < gamblers.length; i++) { gamblers[i].move(casinoFloor.bettingTables); } if (cheaterClickCountdown > 0) { cheaterClickCountdown -= 1000 / 60; countdownTxt.setText(Math.ceil(cheaterClickCountdown / 1000).toString()); } else { countdownTxt.setText('0'); cheaterClickCountdown = 0; } }); LK.setInterval(function () { casinoFloor.repositionTables(); }, 5000); });
===================================================================
--- original.js
+++ change.js
@@ -101,10 +101,10 @@
var countdownTxt = new Text2('5', {
size: 150,
fill: "#ffffff"
});
- countdownTxt.anchor.set(.5, 1);
- LK.gui.bottom.addChild(countdownTxt);
+ countdownTxt.anchor.set(1, 0);
+ LK.gui.topRight.addChild(countdownTxt);
var casinoFloor = new CasinoFloor();
self.addChild(casinoFloor);
var healthBar = new HealthBar();
LK.gui.topLeft.addChild(healthBar);
Typical cassino floor with green carpet and slot machines lined on the edges of the screen. It should fit the entirety of the screen. It is a topdown view. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A top down view of one blackjack betting table with one dealer per table. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Cassino security guard badge. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Top down image of an old lady carrying poker tokens. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Top down image of an old lady carrying poker tokens wearing sunglasses. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.