User prompt
Make clicking on a cheater add 1 score point
User prompt
make the point system positive
User prompt
Make the health bar shaped as a security badge
User prompt
create a health bar of 3 tries before game over
User prompt
define that each time you click on a cheater, points increase by 1
User prompt
Fix Bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'isCheater')' in this line: 'self.isCheater = true;' Line Number: 8
Initial prompt
Whack 'a Cheater
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; }); 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); var gamblers = []; var cheaters = []; var score = 0; var scoreTxt; 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); for (var i = 0; i < 10; 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 < 3) { var cheater = new Cheater(); cheater.x = Math.random() * 2048; cheater.y = Math.random() * 2732; self.addChild(cheater); cheaters.push(cheater); cheater.on('down', function (obj) { score += 1; scoreTxt.setText(score); obj.destroy(); }); } } LK.on('tick', function () {}); });
===================================================================
--- original.js
+++ change.js
@@ -49,18 +49,12 @@
gambler.y = Math.random() * 2732;
self.addChild(gambler);
gamblers.push(gambler);
gambler.on('down', function (obj) {
- if (obj.isCheater) {
- score += 1;
- scoreTxt.setText(score);
- obj.destroy();
- } else {
- healthBar.removeTry();
- if (healthBar.isGameOver()) {
- LK.effects.flashScreen(0xff0000, 1000);
- LK.showGameOver();
- }
+ healthBar.removeTry();
+ if (healthBar.isGameOver()) {
+ LK.effects.flashScreen(0xff0000, 1000);
+ LK.showGameOver();
}
});
if (i < 3) {
var cheater = new Cheater();
@@ -68,13 +62,11 @@
cheater.y = Math.random() * 2732;
self.addChild(cheater);
cheaters.push(cheater);
cheater.on('down', function (obj) {
- if (obj.isCheater) {
- score++;
- scoreTxt.setText(score);
- obj.destroy();
- } else {}
+ score += 1;
+ scoreTxt.setText(score);
+ obj.destroy();
});
}
}
LK.on('tick', function () {});
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.