User prompt
when a present is delivered to the chimney change the color of the chimney
User prompt
add condition to chimney to be delivered or not
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in this line: 'for (var i = 0; i < self.presents.length; i++) {' Line Number: 41
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in this line: 'for (var i = 0; i < self.presents.length; i++) {' Line Number: 41
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in this line: 'for (var i = 0; i < self.presents.length; i++) {' Line Number: 41
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in this line: 'for (var i = 0; i < self.presents.length; i++) {' Line Number: 41
User prompt
when present collides with chimeny mark as delivered
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in this line: 'for (var i = 0; i < self.presents.length; i++) {' Line Number: 37
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in this line: 'for (var i = 0; i < self.presents.length; i++) {' Line Number: 37
User prompt
Fix Bug: 'Uncaught ReferenceError: scoreTxt is not defined' in this line: 'scoreTxt.anchor.set(.5, 0);' Line Number: 85
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in this line: 'for (var i = 0; i < self.presents.length; i++) {' Line Number: 37
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in this line: 'for (var i = 0; i < self.presents.length; i++) {' Line Number: 37
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in this line: 'for (var i = 0; i < self.presents.length; i++) {' Line Number: 37
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in this line: 'for (var i = 0; i < self.presents.length; i++) {' Line Number: 37
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in this line: 'for (var i = 0; i < self.presents.length; i++) {' Line Number: 37
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in this line: 'for (var i = 0; i < self.presents.length; i++) {' Line Number: 37
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in this line: 'for (var i = 0; i < self.presents.length; i++) {' Line Number: 37
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in this line: 'for (var i = 0; i < self.presents.length; i++) {' Line Number: 37
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in this line: 'for (var i = 0; i < self.presents.length; i++) {' Line Number: 37
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in this line: 'for (var i = 0; i < presents.length; i++) {' Line Number: 37
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in this line: 'for (var i = 0; i < presents.length; i++) {' Line Number: 37
User prompt
when present collides with chimney add a point
User prompt
hazards need to move like the chimeny
User prompt
hazards should move from right to left in the eight tenths of the screen. there should always be 5 hazards on screen
User prompt
invert present direction
var Santa = Container.expand(function () { var self = Container.call(this); var santaGraphics = self.createAsset('santa', 'Santa character', .5, .5); self.move = function (pos) { self.x += (pos.x - self.x) * 0.1; self.y += (pos.y - self.y) * 0.1; }; self.throwPresent = function () { var present = new Present(); present.x = this.x; present.y = this.y; this.parent.addChild(present); this.parent.presents.push(present); }; }); var Present = Container.expand(function () { var self = Container.call(this); var presentGraphics = self.createAsset('present', 'Present', .5, .5); self.move = function () { this.y += 5; if (this.y > 2732) { this.destroy(); } }; }); var Chimney = Container.expand(function () { var self = Container.call(this); var chimneyGraphics = self.createAsset('chimney', 'Chimney', .5, .5); self.speed = 2; self.move = function () { self.x -= self.speed; if (self.x < -self.width) { self.destroy(); } }; self.checkCollision = function (presents) { for (var i = 0; i < self.presents.length; i++) { var present = presents[i]; if (this.intersects(present)) { LK.setScore(LK.getScore() + 1); present.destroy(); presents.splice(i, 1); i--; } } }; }); var Hazard = Container.expand(function () { var self = Container.call(this); var hazardGraphics = self.createAsset('hazard', 'Hazard', .5, .5); self.move = function () { if (self.x < 2048 - self.width) { self.x += 2; } else { self.x = -self.width; } }; }); var Game = Container.expand(function () { var self = Container.call(this); var santa = self.addChild(new Santa()); santa.x = 2048 / 2; santa.y = 0; self.presents = []; var chimneys = []; var maxChimneys = 5; LK.on('tick', function () { if (chimneys.length < maxChimneys) { var lastChimney = chimneys[chimneys.length - 1]; if (!lastChimney || lastChimney.x < 2048 - lastChimney.width - 300) { var newChimney = new Chimney(); newChimney.x = 2048; newChimney.y = 2732 - newChimney.height - Math.random() * 500; chimneys.push(newChimney); self.addChild(newChimney); } } chimneys.forEach(function (chimney) { chimney.move(); }); chimneys = chimneys.filter(function (chimney) { return chimney.x + chimney.width > 0; }); }); var scoreTxt = new Text2('0', { size: 150, fill: "#ffffff" }); scoreTxt.anchor.set(.5, 0); LK.gui.topCenter.addChild(scoreTxt); LK.on('tick', function () { for (var i = 0; i < self.presents.length; i++) { self.presents[i].move(); } for (var i = 0; i < chimneys.length; i++) { chimneys[i].checkCollision(self.presents); } for (var i = 0; i < hazards.length; i++) { hazards[i].move(); } }); stage.on('move', function (obj) { var pos = obj.event.getLocalPosition(self); santa.move(pos); }); stage.on('up', function (obj) { santa.throwPresent(); LK.setScore(LK.getScore() + 1); scoreTxt.setText(LK.getScore().toString()); }); });
===================================================================
--- original.js
+++ change.js
@@ -81,8 +81,12 @@
chimneys = chimneys.filter(function (chimney) {
return chimney.x + chimney.width > 0;
});
});
+ var scoreTxt = new Text2('0', {
+ size: 150,
+ fill: "#ffffff"
+ });
scoreTxt.anchor.set(.5, 0);
LK.gui.topCenter.addChild(scoreTxt);
LK.on('tick', function () {
for (var i = 0; i < self.presents.length; i++) {
8-bit cloud with lightning. in game asset. white cloude. yellow lighning. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
8 bit x mas pressent. in game asset. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
8-bit. cartoon. santa on sledge. smiling. in game asset. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.