User prompt
Fix Bug: 'TypeError: undefined is not an object (evaluating 'self.playerYPositionText.setText')' in this line: 'self.playerYPositionText.setText('Y: ' + Math.round(self.player.y));' Line Number: 98
User prompt
Add a gui for candyCanes[0] y Check existence before using
User prompt
Fix Bug: 'TypeError: undefined is not an object (evaluating 'LK.gui.bottomCenter.addChild')' in this line: 'LK.gui.bottomCenter.addChild(candyCaneYPositionText);' Line Number: 126
User prompt
Fix Bug: 'TypeError: undefined is not an object (evaluating 'LK.gui.bottomCenterLeft.addChild')' in this line: 'LK.gui.bottomCenterLeft.addChild(candyCaneYPositionText);' Line Number: 126
User prompt
Fix Bug: 'TypeError: undefined is not an object (evaluating 'LK.gui.bottomCenter.addChild')' in this line: 'LK.gui.bottomCenter.addChild(candyCaneYPositionText);' Line Number: 126
User prompt
Fix Bug: 'TypeError: undefined is not an object (evaluating 'candyCanes[0]')' in this line: 'var candyCaneYPositionText = new Text2('Y: ' + candyCanes[0].y, {' Line Number: 108
User prompt
Add a gui for candyCanes[0] y
User prompt
Move player y gui to the left corner
User prompt
Fix human player not fading out after selecting
User prompt
Fix player not fading in after computer play
User prompt
Fix player not displayed after computer play
User prompt
Fix Bug: 'TypeError: LK.effects.fadeOut is not a function. (In 'LK.effects.fadeOut(self.player, 500)', 'LK.effects.fadeOut' is undefined)' in this line: 'LK.effects.fadeOut(self.player, 500);' Line Number: 163
User prompt
Fix Bug: 'ReferenceError: Can't find variable: fadeOut' in this line: 'fadeOut(self.player, 500);' Line Number: 163
User prompt
Don’t use fadeout, use a change of alpha
User prompt
Fix Bug: 'TypeError: LK.effects.fadeOut is not a function. (In 'LK.effects.fadeOut(self.player, 500)', 'LK.effects.fadeOut' is undefined)' in this line: 'LK.effects.fadeOut(self.player, 500);' Line Number: 163
User prompt
Fix Bug: 'TypeError: self.fadeOut is not a function. (In 'self.fadeOut(self.player, 500)', 'self.fadeOut' is undefined)' in this line: 'self.fadeOut(self.player, 500);' Line Number: 163
User prompt
Fix Bug: 'TypeError: LK.effects.fadeOut is not a function. (In 'LK.effects.fadeOut(self.player, 500)', 'LK.effects.fadeOut' is undefined)' in this line: 'LK.effects.fadeOut(self.player, 500);' Line Number: 163
User prompt
Fix human player not fading out after selecting
User prompt
Fix the players toggle
User prompt
Fix computer always visible.
User prompt
Move the background creation to the beginning of the game
User prompt
No players are visible. Please fix
User prompt
Fix Bug: 'TypeError: self.togglePlayerVisibility is not a function. (In 'self.togglePlayerVisibility()', 'self.togglePlayerVisibility' is undefined)' in this line: 'self.togglePlayerVisibility();' Line Number: 156
User prompt
Still no players visible!!!
User prompt
Still no players visible
var LastCandyCane = Container.expand(function () { var self = Container.call(this); var candyCaneGraphics = self.createAsset('lastCandyCane', 'Last Candy Cane', .5, .5); var shadow = new Container(); var shadowAlpha = 0.8; shadow.createAsset('candyCaneShadow', 'Candy Cane Shadow', 0, 0); shadow.width = shadow.width / 4; shadow.x = -400; shadow.y = -10; shadow.alpha = shadowAlpha; self.addChildAt(shadow, 0); var shadow2 = new Container(); shadow2.createAsset('candyCaneShadow', 'Candy Cane Shadow', 0, 0); shadow2.width = shadow2.width / 4; shadow2.x = 25; shadow2.y = -10; shadow2.alpha = shadowAlpha; self.addChildAt(shadow2, 0); var shadowCentral = new Container(); shadowCentral.createAsset('candyCaneShadowCentral', 'Candy Cane Shadow Central', 0, 0); shadowCentral.x = -305; shadowCentral.y = -10; shadowCentral.alpha = shadowAlpha; self.addChildAt(shadowCentral, 0); }); var CandyCane = Container.expand(function () { var self = Container.call(this); var candyCaneGraphics = self.createAsset('candyCane', 'Candy Cane', .5, .5); var shadow = new Container(); var shadowAlpha = 0.8; shadow.createAsset('candyCaneShadow', 'Candy Cane Shadow', 0, 0); shadow.width = shadow.width / 4; shadow.x = -320; shadow.y = -10; shadow.alpha = shadowAlpha; self.addChildAt(shadow, 0); var shadow2 = new Container(); shadow2.createAsset('candyCaneShadow', 'Candy Cane Shadow', 0, 0); shadow2.width = shadow2.width / 4; shadow2.x = 120; shadow2.y = -10; shadow2.alpha = shadowAlpha; self.addChildAt(shadow2, 0); var shadowCentral = new Container(); shadowCentral.createAsset('candyCaneShadowCentral', 'Candy Cane Shadow Central', 0, 0); shadowCentral.x = -225; shadowCentral.y = -10; shadowCentral.alpha = shadowAlpha; self.addChildAt(shadowCentral, 0); self.pick = function () { self.parent.selectedCandiesCount++; var selectedCandiesText = LK.gui.topCenter.children[0]; selectedCandiesText.setText(self.parent.selectedCandiesCount.toString()); console.log("Picked ", self); }; }); var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.createAsset('player', 'Player', .5, .5); self.pickCandyCane = function () { self.computerPlayer.pickCandyCane(); self.alpha = 0; }; }); var ComputerPlayer = Container.expand(function () { var self = Container.call(this); var computerPlayerGraphics = self.createAsset('computerPlayer', 'Computer Player', .5, .5); self.pickCandyCane = function () { playerTurn = !playerTurn; if (playerTurn) { self.alpha = 0; } else { self.alpha = 1; self.parent.addChild(self); } self.alpha = 0; }; self.update = function () {}; }); var Game = Container.expand(function () { var self = Container.call(this); self.fadeOut = function (target, duration) { var alphaDelta = target.alpha / (duration / (1000 / 60)); var fadeInterval = LK.setInterval(function () { if (target.alpha > 0) { target.alpha -= alphaDelta; if (target.alpha <= 0) { target.alpha = 0; LK.clearInterval(fadeInterval); } } }, 1000 / 60); }; var background = self.createAsset('background', 'Game Background', 0.2545, 0.215); self.addChildAt(background, 0); LK.on('tick', function () { if (self.player) { self.playerYPositionText.setText('Y: ' + Math.round(self.player.y)); } }); self.selectedCandiesCount = 0; var selectedCandiesText = new Text2(self.selectedCandiesCount.toString(), { size: 100, fill: "#ffffff" }); selectedCandiesText.anchor.set(.5, 0); LK.gui.topCenter.addChild(selectedCandiesText); var candyCanes = []; for (var i = 0; i < 12; i++) { var candyCane = new CandyCane(); candyCane.x = 2048 / 2; candyCane.y = 250 + i * 190; candyCanes.push(candyCane); self.addChild(candyCane); } var lastCandyCane = new LastCandyCane(); lastCandyCane.x = 2048 / 2 + 80; lastCandyCane.y = 250 + 12 * 190; candyCanes.push(lastCandyCane); self.addChild(lastCandyCane); var candyCaneYPositionText = new Text2('Y: ' + candyCanes[0].y, { size: 100, fill: "#ffffff" }); candyCaneYPositionText.anchor.set(0.5, 0); LK.gui.bottomCenterLeft.addChild(candyCaneYPositionText); self.player = self.addChild(new Player()); self.player.x = 400; self.player.y = 70; self.playerYPositionText = new Text2('Y: ' + self.player.y, { size: 100, fill: "#ffffff" }); self.playerYPositionText.anchor.set(0, 0); LK.gui.topLeft.addChild(self.playerYPositionText); var playerTurn = true; self.computerPlayer = new ComputerPlayer(); self.computerPlayer.x = 1648; self.computerPlayer.y = 1324; var candyCanes = []; for (var i = 0; i < 12; i++) { var candyCane = new CandyCane(); candyCane.x = 2048 / 2; candyCane.y = 250 + i * 190; candyCanes.push(candyCane); self.addChild(candyCane); } var lastCandyCane = new LastCandyCane(); lastCandyCane.x = 2048 / 2 + 80; lastCandyCane.y = 250 + 12 * 190; candyCanes.push(lastCandyCane); self.addChild(lastCandyCane); stage.on('down', function (obj) { console.log('Mouse down event:', obj); stage.on('move', handleSelection); }); function handleSelection(obj) { var event = obj.event; var pos = event.getLocalPosition(self); var topCandyIndex = 0; var minY = candyCanes[0].y; var maxY = candyCanes[2].y + 140; self.player.y = Math.max(minY, Math.min(maxY, pos.y)); if (self.player.y < candyCanes[topCandyIndex].y + 120) { self.selectedCandiesCount = 1; } else if (self.player.y < candyCanes[topCandyIndex + 1].y + 120) { self.selectedCandiesCount = 2; } else { self.selectedCandiesCount = 3; } for (var i = 0; i < candyCanes.length; i++) { if (i < self.selectedCandiesCount) { candyCanes[i].scale.set(1.1); } else { candyCanes[i].scale.set(1); } } var selectedCandiesText = LK.gui.topCenter.children[0]; selectedCandiesText.setText(self.selectedCandiesCount.toString()); } stage.on('up', function (obj) { console.log('Mouse up event:', obj); stage.off('move', handleSelection); var candiesToRemove = candyCanes.splice(0, self.selectedCandiesCount); for (var i = 0; i < candiesToRemove.length; i++) { candiesToRemove[i].destroy(); } self.selectedCandiesCount = 0; var selectedCandiesText = LK.gui.topCenter.children[0]; selectedCandiesText.setText(self.selectedCandiesCount.toString()); if (playerTurn) { self.fadeOut(self.player, 500); self.computerPlayer.alpha = 1; self.addChild(self.computerPlayer); } else { self.fadeOut(self.player, 500); self.computerPlayer.alpha = 0; self.computerPlayer.parent.removeChild(self.computerPlayer); } playerTurn = !playerTurn; }); });
===================================================================
--- original.js
+++ change.js
@@ -122,9 +122,9 @@
size: 100,
fill: "#ffffff"
});
candyCaneYPositionText.anchor.set(0.5, 0);
- LK.gui.bottomCenter.addChild(candyCaneYPositionText);
+ LK.gui.bottomCenterLeft.addChild(candyCaneYPositionText);
self.player = self.addChild(new Player());
self.player.x = 400;
self.player.y = 70;
self.playerYPositionText = new Text2('Y: ' + self.player.y, {
a christmas wooden board Background image. High contrast. No shadows.
a vertical christmas wooden board with snow, and decorations on its sides Background image. High contrast. No shadows.
a photo-realistic white and red vertical candy stick slice Single Game Texture. No background. High contrast. No shadows.
a horizontal santa's arm with a white glove and the index pointing to the right Single Game Texture. No background. High contrast. No shadows.
an green hairy grinch's arm, pointing in the horizontal direction, the index finger pointing to the left Single Game Texture. No background. High contrast. No shadows.
a photo-realistic white and red twisted candy stick slice in vertical position and with an extinguished wick. At its center, a simple white rectangular "TNT" sticker in the same direction as the stick Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a top view of a TNT explosion fire Background image. High contrast. No shadows.
A funny Santa Claus disheveled and covered by black soot after an explosion. stary night. High contrast.
a futuristic white robot arm. horizontal direction. the index finger pointing to the left. Single Game Texture. No background. High contrast. No shadows.
A old super hero Santa Claus holding a candy cane in his hand High contrast.
frame of an empty christmas themed popup with a decorated border User interface
a single mat rounded empty button User interface