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
===================================================================
--- original.js
+++ change.js
@@ -14,12 +14,8 @@
};
});
var Present = Container.expand(function () {
var self = Container.call(this);
- self.markDelivered = function () {
- this.delivered = true;
- this.destroy();
- };
var presentGraphics = self.createAsset('present', 'Present', .5, .5);
self.move = function () {
this.y += 5;
if (this.y > 2732) {
@@ -29,25 +25,17 @@
});
var Chimney = Container.expand(function () {
var self = Container.call(this);
var chimneyGraphics = self.createAsset('chimney', 'Chimney', .5, .5);
+ self.needsPresent = Math.random() > 0.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)) {
- present.markDelivered();
- presents.splice(i, 1);
- i--;
- }
- }
- };
+ self.checkCollision = function () {};
});
var Hazard = Container.expand(function () {
var self = Container.call(this);
var hazardGraphics = self.createAsset('hazard', 'Hazard', .5, .5);
@@ -66,10 +54,13 @@
santa.y = 0;
self.presents = [];
var chimneys = [];
var hazards = [];
+ var scoreTxt = new Text2('0', {
+ size: 150,
+ fill: "#ffffff"
+ });
var maxChimneys = 5;
- self.presents = [];
LK.on('tick', function () {
if (chimneys.length < maxChimneys) {
var lastChimney = chimneys[chimneys.length - 1];
if (!lastChimney || lastChimney.x < 2048 - lastChimney.width - 300) {
@@ -81,25 +72,29 @@
}
}
chimneys.forEach(function (chimney) {
chimney.move();
+ self.presents.forEach(function (present) {
+ if (chimney.needsPresent && present.intersects(chimney)) {
+ chimney.needsPresent = false;
+ present.destroy();
+ LK.setScore(LK.getScore() + 1);
+ scoreTxt.setText(LK.getScore().toString());
+ }
+ });
});
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);
+ chimneys[i].checkCollision();
}
for (var i = 0; i < hazards.length; i++) {
hazards[i].move();
}
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.