User prompt
Fix Bug: 'TypeError: this.addChild is not a function' in this line: 'var houseGraphics = House.prototype.createAsset.call(self, 'niceHouse', 'Nice House Graphics', .5, 1);' Line Number: 44
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'createAsset')' in this line: 'var houseGraphics = self.createAsset('niceHouse', 'Nice House Graphics', .5, 1);' Line Number: 44
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'createAsset')' in this line: 'var houseGraphics = self.createAsset('naughtyHouse', 'Naughty House Graphics', .5, 1);' Line Number: 35
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'createAsset')' in this line: 'self.createAsset('naughtyHouse', 'Naughty House Graphics', .5, 1).then(function (houseGraphics) {' Line Number: 35
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'createAsset')' in this line: 'var houseGraphics = self.createAsset('naughtyHouse', 'Naughty House Graphics', .5, 1);' Line Number: 35
User prompt
Fix Bug: 'TypeError: this.addChild is not a function' in this line: 'var houseGraphics = House.prototype.createAsset.call(self, 'niceHouse', 'Nice House Graphics', .5, 1);' Line Number: 43
User prompt
Fix Bug: 'TypeError: this.addChild is not a function' in this line: 'var houseGraphics = House.prototype.createAsset.call(self, 'naughtyHouse', 'Naughty House Graphics', .5, 1);' Line Number: 35
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'createAsset')' in this line: 'var houseGraphics = self.createAsset('naughtyHouse', 'Naughty House Graphics', .5, 1);' Line Number: 35
User prompt
Fix Bug: 'TypeError: this.addChild is not a function' in this line: 'var houseGraphics = House.prototype.createAsset.call(self, 'naughtyHouse', 'Naughty House Graphics', .5, 1);' Line Number: 35
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'createAsset')' in this line: 'var houseGraphics = self.createAsset('naughtyHouse', 'Naughty House Graphics', .5, 1);' Line Number: 35
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'createAsset')' in this line: 'var houseGraphics = self.createAsset('naughtyHouse', 'Naughty House Graphics', .5, 1);' Line Number: 35
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'createAsset')' in this line: 'var houseGraphics = self.createAsset('niceHouse', 'Nice House Graphics', .5, 1);' Line Number: 44
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'createAsset')' in this line: 'var houseGraphics = self.createAsset('niceHouse', 'Nice House Graphics', .5, 1);' Line Number: 44
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'createAsset')' in this line: 'var houseGraphics = self.createAsset('naughtyHouse', 'Naughty House Graphics', .5, 1);' Line Number: 35
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'createAsset')' in this line: 'var houseGraphics = self.createAsset('niceHouse', 'Nice House Graphics', .5, 1);' Line Number: 43
User prompt
House movement continues uninterrupted even as houses change from naughty, nice, dark, or happy
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'addChild')' in this line: 'self.parent.addChild(happyHouse);' Line Number: 60
User prompt
If a nice house is hit by 3 presents, it becomes happy
User prompt
If a nice house is hit by a present, the player gains 1 joy
User prompt
The player cannot go below 0 joy
User prompt
If a naughty house is hit by a present, the player loses 3 joy and the naughty house turns into a dark house
User prompt
Initially, 50% of houses spawn as naughty and 50% as nice
User prompt
There is a pause button in the top left corner of the screen that pauses and unpauses the game
User prompt
Fix Bug: 'TypeError: house.getNaughty is not a function' in this line: 'if (present.intersects(house) && !house.getNaughty()) {' Line Number: 136
User prompt
Fix Bug: 'ReferenceError: House is not defined' in this line: 'var house = new House();' Line Number: 119
var JoyMeter = Container.expand(function () { var self = Container.call(this); self.joy = 0; self.maxJoy = 8; var joyMeterGraphics = self.createAsset('joyMeter', 'Joy Meter Graphics', 0.5, 0); joyMeterGraphics.y = 50; self.addJoy = function (amount) { self.joy = Math.max(0, self.joy + amount); if (self.joy > self.maxJoy) { self.joy = self.maxJoy; } joyMeterGraphics.width = 2048 / self.maxJoy * self.joy; }; self.getJoy = function () { return self.joy; }; }); var Present = Container.expand(function () { var self = Container.call(this); var presentGraphics = self.createAsset('present', 'Present Graphics', .5, .5); self.speed = -10; self.move = function () { self.y += self.speed; }; }); var House = Container.expand(function () { var self = Container.call(this); self.speed = 2; self.move = function () { self.y += self.speed; }; }); var NaughtyHouse = House.expand(function () { var self = House.call(this); var houseGraphics = self.createAsset('naughtyHouse', 'Naughty House Graphics', .5, 1); var houseGraphics = self.createAsset('naughtyHouse', 'Naughty House Graphics', .5, 1); houseGraphics.tint = 0xff0000; self.getNaughty = function () { return true; }; }); var NiceHouse = House.expand(function () { var self = House.call(this); var houseGraphics = self.createAsset('niceHouse', 'Nice House Graphics', .5, 1); houseGraphics.tint = 0x00ff00; self.hitCount = 0; self.getNaughty = function () { return false; }; self.incrementHits = function () { self.hitCount++; if (self.hitCount >= 3) { self.transformToHappy(); } }; self.transformToHappy = function () { var happyHouse = new HappyHouse(); happyHouse.x = self.x; happyHouse.y = self.y; LK.stage.addChild(happyHouse); self.destroy(); }; }); var DarkHouse = House.expand(function () { var self = House.call(this); var houseGraphics = self.createAsset('darkHouse', 'Dark House Graphics', .5, 1); houseGraphics.tint = 0x808080; self.getNaughty = function () { return false; }; }); var HappyHouse = House.expand(function () { var self = House.call(this); var houseGraphics = self.createAsset('happyHouse', 'Happy House Graphics', .5, 1); houseGraphics.tint = 0xffff00; self.getNaughty = function () { return false; }; }); var Santa = Container.expand(function () { var self = Container.call(this); var santaGraphics = self.createAsset('santa', 'Santa Graphics', .5, .5); self.targetPosition = null; self.moveSpeed = 5; self.move = function (position) { if (position) { self.targetPosition = position; } if (self.targetPosition) { var dx = self.targetPosition.x - self.x; var dy = self.targetPosition.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 1) { var angle = Math.atan2(dy, dx); var tentativeX = self.x + Math.cos(angle) * self.moveSpeed; var tentativeY = self.y + Math.sin(angle) * self.moveSpeed; self.x = tentativeX; if (tentativeY > 2732 - 2732 / 3) { self.y = tentativeY; } } else { if (self.targetPosition.y > 2732 - 2732 / 3) { self.x = self.targetPosition.x; self.y = self.targetPosition.y; } self.targetPosition = null; } } }; }); var Game = Container.expand(function () { var self = Container.call(this); var houses = []; var presents = []; var joyMeter = self.addChild(new JoyMeter()); LK.gui.topCenter.addChild(joyMeter); var santa = self.addChild(new Santa()); santa.x = 2048 / 2; santa.y = 2732 - 2732 * 0.1; var presentFireRate = 60; var presentFireCounter = 0; stage.on('down', function (obj) { var pos = obj.event.getLocalPosition(self); santa.move(pos); }); LK.on('tick', function () { santa.move(); if (presentFireCounter++ >= presentFireRate) { var present = new Present(); present.x = santa.x; present.y = santa.y; presents.push(present); self.addChild(present); presentFireCounter = 0; } if (Math.random() < 0.02) { var houseTypes = [NaughtyHouse, NiceHouse]; var randomHouseType = houseTypes[Math.floor(Math.random() * houseTypes.length)]; var house = new randomHouseType(); house.x = Math.random() * 2048; house.y = -house.height; houses.push(house); self.addChild(house); } for (var i = presents.length - 1; i >= 0; i--) { var present = presents[i]; present.move(); if (present.y < -present.height) { present.destroy(); presents.splice(i, 1); } else { for (var j = 0; j < houses.length; j++) { var house = houses[j]; if (present.intersects(house)) { if (house.getNaughty()) { joyMeter.addJoy(-3); var darkHouse = new DarkHouse(); darkHouse.x = house.x; darkHouse.y = house.y; self.addChild(darkHouse); house.destroy(); houses.splice(j, 1); houses.push(darkHouse); } else { joyMeter.addJoy(1); if (house instanceof NiceHouse) { house.incrementHits(); } } present.destroy(); presents.splice(i, 1); break; } } } for (var h = houses.length - 1; h >= 0; h--) { var house = houses[h]; house.move(); if (house.y > 2732 + house.height) { house.destroy(); houses.splice(h, 1); } } } }); });
===================================================================
--- original.js
+++ change.js
@@ -32,8 +32,9 @@
});
var NaughtyHouse = House.expand(function () {
var self = House.call(this);
var houseGraphics = self.createAsset('naughtyHouse', 'Naughty House Graphics', .5, 1);
+ var houseGraphics = self.createAsset('naughtyHouse', 'Naughty House Graphics', .5, 1);
houseGraphics.tint = 0xff0000;
self.getNaughty = function () {
return true;
};
overhead view of simple box house christmas decorations giant christmas tree out front video game asset 2d blank background Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
overhead view of drab house with giant prohibition symbol snowy lawn video game asset 2d blank background Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
overhead view of charred remains of a completely burned down box house snowy lawn video game asset 2d blank background Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Santa on sleigh pulled by reindeer blank background no shadows flying forward away straight top down Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
simple red christmas ornament 2d blank background high contrast no shadows in game asset Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
simple snowflake In-Game asset. 2d. Blank background. High contrast. No shadows. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
old white scroll unfurled blank no shadows Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
top down simple wrapped red present with gold bow. In-Game asset. 2d. Blank background. High contrast. No shadows. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
top down plate of cookies glass of milk. In-Game asset. Blank background. No shadows. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.