User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'respawnReindeer')' in this line: 'self.gameInstance.respawnReindeer();' Line Number: 31
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'respawnReindeer')' in this line: 'self.gameInstance.respawnReindeer();' Line Number: 32
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'respawnReindeer')' in this line: 'self.gameInstance.respawnReindeer();' Line Number: 31
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'parent')' in this line: 'self.parent.parent.respawnReindeer();' Line Number: 31
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'respawnReindeer')' in this line: 'self.parent.respawnReindeer();' Line Number: 31
User prompt
Fix Bug: 'TypeError: LK.stageContainer.children[0].respawnReindeer is not a function' in this line: 'LK.stageContainer.children[0].respawnReindeer();' Line Number: 31
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'respawnReindeer')' in this line: 'self.parent.respawnReindeer();' Line Number: 31
User prompt
Fix Bug: 'TypeError: self.getGameInstance is not a function' in this line: 'self.getGameInstance().respawnReindeer();' Line Number: 31
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'respawnReindeer')' in this line: 'self.parent.respawnReindeer();' Line Number: 31
User prompt
make sure the initial reindeer instantiated can be destroyed
User prompt
make sure the arc of the reindeer stays in the upper portion of the playspace
User prompt
make sure the reindeer does not go outside of the boundaries
User prompt
reduce the eraticaness movement of the reindeer and fix the arc so that it stays near the center of the screen
User prompt
reduce the eraticaness of the reindeer movement
User prompt
the initial reindeer that is spawned does not move, fix it
User prompt
the initial reindeer should also move eratically
User prompt
when the reindeer is destroyed, respawn the reindeer again in 8 or 12 seconds
User prompt
why is the reindeer not moving, make it move erratically
User prompt
when the reindeer is created, make it move to make it difficult to target
User prompt
the reindeer is not moving make it move when it spawns
User prompt
the reindeer is still static, if it spawns in the right side of the screen it should flips its visual and move in an arc to the left
User prompt
the reindeer is currently static, make it move in an arc when it spawns from one edge of the screen to the other
User prompt
fix the reindeer not moving upon spawning
User prompt
the reindeer is not moving
User prompt
make sure the reindeer moves in an arc from one side of the screen to the other
var Reindeer = Container.expand(function () {
var self = Container.call(this);
var reindeerGraphics = self.createAsset('reindeer', 'Reindeer', 0.5, 0.5);
self.arcSpeed = 0.02;
self.moveInArc = function () {
self.arcAngle += self.arcSpeed * self.arcDirection;
self.x = 2048 / 2 + Math.cos(self.arcAngle) * self.arcRadius;
self.y = 2732 / 2 + Math.sin(self.arcAngle) * self.arcRadius;
if (self.arcAngle > Math.PI * 2 || self.arcAngle < -Math.PI * 2) {
self.destroy();
}
};
self.on('down', function (obj) {
LK.setScore(LK.getScore() + 25);
LK.gui.topCenter.children[0].setText(LK.getScore().toString());
var greatText = new Text2('Great!', {
size: 40,
fill: '#ffffff',
font: 'Arial Black'
});
greatText.x = self.x;
greatText.y = self.y;
greatText.anchor.set(0.5, 0.5);
self.parent.addChild(greatText);
LK.setTimeout(function () {
greatText.destroy();
}, 1000);
self.destroy();
});
});
var RandomText = Container.expand(function () {
var self = Container.call(this);
self.display = function (x, y, messages) {
var message = messages[Math.floor(Math.random() * messages.length)];
var text = new Text2(message, {
size: 48,
fill: '#ff0000',
font: 'Arial Black'
});
text.x = x - 400;
text.y = y + 175;
text.anchor.set(0.5, 0.5);
self.addChild(text);
LK.setTimeout(function () {
text.destroy();
self.parent.randomTextActive = false;
}, 3000);
};
});
var Mistletoe = Container.expand(function () {
var self = Container.call(this);
var mistletoeGraphics = self.createAsset('mistletoe', 'Mistletoe', 0.5, 0.5);
var bobbingRange = 10;
var bobbingSpeed = 0.2;
var bobbingPosition = 0;
self.bob = function () {
bobbingPosition += bobbingSpeed;
self.y += Math.sin(bobbingPosition) * bobbingRange;
};
self.on('down', function (obj) {
LK.setScore(LK.getScore() + 10);
LK.gui.topCenter.children[0].setText(LK.getScore().toString());
self.parent.respawnMistletoe(self);
});
});
var Snowflake = Container.expand(function () {
var self = Container.call(this);
var sizeFactor = Math.random() * 0.5 + 0.5;
var snowflakeGraphics = self.createAsset('snowflake', 'Snowflake', 0.5, 0.5);
snowflakeGraphics.scale.set(sizeFactor);
self.speed = -3 * sizeFactor;
self.move = function () {
self.x += self.speed;
self.y += 0.5;
self.scale.x -= 0.003;
self.scale.y -= 0.003;
if (self.scale.x <= 0 || self.scale.y <= 0) {
self.destroy();
}
};
});
var Heart = Container.expand(function () {
var self = Container.call(this);
var heartGraphics = self.createAsset('heart', 'Player life', 0.5, 0.5);
self.x = heartGraphics.width / 2;
self.y = heartGraphics.height / 2;
});
var MuzzleFlash = Container.expand(function () {
var self = Container.call(this);
self.visible = false;
var flashGraphics = self.createAsset('muzzleFlash', 'Muzzle flash effect', .5, .5);
self.show = function () {
var randomScale = Math.random() * 0.125 + 0.375;
self.scale.set(randomScale);
self.visible = true;
LK.setTimeout(function () {
self.visible = false;
self.scale.set(1);
}, 100);
};
});
var Santa = Container.expand(function () {
var self = Container.call(this);
self.santaGraphics = self.createAsset('santa', 'Santa character', .5, .5);
self.move = function () {};
self.shoot = function () {};
});
var Crosshair = Container.expand(function () {
var self = Container.call(this);
self.move = function (event) {
var pos = event.getLocalPosition(self.parent);
self.x = pos.x;
self.y = pos.y;
};
var crosshairGraphics = self.createAsset('crosshair', 'Crosshair', .5, .5);
self.y = -crosshairGraphics.height / 2;
self.destroy = function () {};
});
var Game = Container.expand(function () {
var self = Container.call(this);
self.showGreatText = function (x, y) {
var greatText = new Text2('Nice!', {
size: 40,
fill: '#ffffff',
font: 'Arial Black'
});
greatText.x = x;
greatText.y = y;
greatText.anchor.set(0.5, 0.5);
self.addChild(greatText);
LK.setTimeout(function () {
greatText.destroy();
}, 1000);
};
var silentNightText = new Text2('Silent Night', {
size: 150,
fill: "#ffffff"
});
silentNightText.anchor.set(0.5, 0);
silentNightText.x = 5 / 2;
silentNightText.y = 150;
LK.gui.topCenter.addChild(silentNightText);
self.generateSnowflakes = function () {
var snowflakeInterval = LK.setInterval(function () {
var snowflake = new Snowflake();
snowflake.x = Math.random() * 2048;
snowflake.y = Math.random() * 2732;
self.addChild(snowflake);
}, 1000);
};
LK.setTimeout(function () {
var fadeOutDuration = 2000;
var fadeOutStep = 0.05;
var fadeOutInterval = LK.setInterval(function () {
silentNightText.alpha -= fadeOutStep;
if (silentNightText.alpha <= 0) {
LK.clearInterval(fadeOutInterval);
silentNightText.destroy();
self.score = 0;
self.scoreText = new Text2(self.score.toString(), {
size: 150,
fill: "#ffffff"
});
self.scoreText.anchor.set(0.5, 0);
self.scoreText.x = 5 / 2;
self.scoreText.y = 150;
LK.gui.topCenter.addChild(self.scoreText);
self.updateScore = function (score) {
self.score += score;
self.scoreText.setText(self.score.toString());
LK.setScore(self.score);
var reindeer = new Reindeer();
var spawnUpperRight = Math.random() < 0.5;
reindeer.x = spawnUpperRight ? 2048 - reindeer.width / 2 : reindeer.width / 2;
reindeer.y = 2732 / 2;
reindeer.arcDirection = 1;
reindeer.arcRadius = 2048 / 2;
reindeer.arcAngle = Math.PI;
reindeer.scale.x = reindeer.arcDirection;
reindeer.moveInArc();
self.addChild(reindeer);
};
}
}, fadeOutDuration * fadeOutStep);
self.generateMistletoes = function () {};
self.generateMistletoes = function () {
LK.setTimeout(function () {
var newMistletoe = new Mistletoe();
var boundaryOffset = 100;
newMistletoe.x = Math.random() * (2048 - 2 * boundaryOffset) + boundaryOffset;
newMistletoe.y = Math.random() * (2732 - 2 * boundaryOffset - newMistletoe.height - 300 - 200 - 500) + boundaryOffset + 200;
self.addChild(newMistletoe);
}, 8000);
};
LK.setTimeout(function () {
var reindeer = new Reindeer();
var boundaryOffset = 100;
reindeer.x = Math.random() < 0.5 ? boundaryOffset : 2048 - boundaryOffset - reindeer.width;
reindeer.y = Math.random() * (2732 / 2 - boundaryOffset) + boundaryOffset;
self.addChild(reindeer);
}, 12000);
LK.setTimeout(self.generateMistletoes, 8000);
}, 2000);
stage.on('move', function (obj) {
crosshair.move(obj.event);
});
stage.on('down', function (obj) {
if (hearts.length > 0) {
muzzleFlash.show();
leftClickPressed = true;
lastClickTime = LK.ticks;
if (!barnMovedDown) {
barnBackground.y += 460;
room1Background.y += 100;
boxBackground.y += 100;
crateBackground.y += 100;
missBackground.y += 460;
tireBackground.y += 100;
barnMovedDown = true;
if (Math.random() < 0.10) {
var messages = ["Santa's special delivery!", "This is for the naughty list!", "Ho, ho, ho-hold this!"];
if (!self.randomTextActive) {
self.randomTextActive = true;
var randomText = new RandomText();
randomText.display(santa.x, santa.y - santa.santaGraphics.height / 2, messages);
self.addChild(randomText);
}
}
}
var heart = hearts.pop();
heart.destroy();
}
});
var room1Background = self.createAsset('Room1', 'Room1 background', 0, 0);
room1Background.anchor.set(0.5, 0.5);
room1Background.x = 2048 / 2;
room1Background.y = 2732 / 2;
self.addChild(room1Background);
var tireBackground = self.createAsset('Tire', 'Tire background', 0.5, 0.5);
tireBackground.anchor.set(0.5, 0.5);
tireBackground.x = 700;
tireBackground.y = 1825;
self.addChild(tireBackground);
self.respawnMistletoe = function (mistletoe) {
this.showGreatText(mistletoe.x, mistletoe.y);
mistletoe.destroy();
LK.setTimeout(function () {
var newMistletoe = new Mistletoe();
var boundaryOffset = 100;
newMistletoe.x = Math.random() * (2048 - 2 * boundaryOffset) + boundaryOffset;
newMistletoe.y = Math.random() * (2732 - 2 * boundaryOffset - newMistletoe.height - 300 - 200 - 100 - 500) + boundaryOffset + 300;
self.addChild(newMistletoe);
}, Math.random() * (15000 - 8000) + 8000);
};
self.generateSnowflakes();
var missBackground = self.createAsset('Miss', 'Miss background', 0, 0);
missBackground.anchor.set(0.5, 0.5);
missBackground.x = 700;
missBackground.y = 2520;
var crateBackground = self.createAsset('Crate', 'Crate background', 0, 0);
crateBackground.anchor.set(0, 1);
crateBackground.x = 205;
crateBackground.y = 2645;
self.addChild(crateBackground);
var boxBackground = self.createAsset('Box', 'Box background', 0, 0);
boxBackground.anchor.set(0, 1);
boxBackground.x = 1350;
boxBackground.y = 2200;
self.addChild(boxBackground);
var barnBackground = self.createAsset('Barn', 'Barn background', 0, 0);
barnBackground.anchor.set(0.5, 0.5);
barnBackground.x = 2048 / 2;
barnBackground.y = 2732 - barnBackground.height / 4 + 900;
self.addChild(barnBackground);
self.addChild(missBackground);
var santa = new Santa();
santa.x = 2048 - santa.santaGraphics.width / 2;
santa.y = 2732 - santa.santaGraphics.height / 2;
self.addChild(santa);
var muzzleFlash = new MuzzleFlash();
muzzleFlash.x = santa.x - santa.santaGraphics.width + 400;
muzzleFlash.y = santa.y - 90;
self.addChild(muzzleFlash);
self.addChild(santa);
var crosshair = self.addChild(new Crosshair());
crosshair.x = 2048 / 2;
crosshair.y = 2732 / 2;
var isGameOver = false;
var tickOffset = 0;
var leftClickPressed = false;
var barnMovedDown = false;
var lastClickTime = 0;
var playerLives = 6;
var hearts = [];
for (var i = 0; i < playerLives; i++) {
var heart = new Heart();
heart.x = 1125 + i * (heart.width + 5);
heart.y = santa.y - santa.santaGraphics.height - heart.height / 2 + 350;
hearts.push(heart);
LK.gui.topLeft.addChild(heart);
}
LK.on('tick', function () {
santa.move();
for (var i = 0; i < self.children.length; i++) {
var child = self.children[i];
if (child instanceof Snowflake) {
child.move();
} else if (child instanceof Mistletoe) {
child.bob();
}
}
if (isGameOver) {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
if (leftClickPressed && LK.ticks - lastClickTime > 30) {
barnBackground.y -= 460;
room1Background.y -= 100;
boxBackground.y -= 100;
crateBackground.y -= 100;
missBackground.y -= 460;
tireBackground.y -= 100;
leftClickPressed = false;
barnMovedDown = false;
while (hearts.length < playerLives) {
var heart = new Heart();
heart.x = 1125 + hearts.length * (heart.width + 5);
heart.y = santa.y - santa.santaGraphics.height - heart.height / 2 + 350;
hearts.push(heart);
LK.gui.topLeft.addChild(heart);
}
}
});
});
over the shoulder santa firing a revolver Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
2d transparent christmas crosshair Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
2d 3rd person front view of a christmas town square with a starry sky Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Christmas sparkles png Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
circular christmas golden star pattern transparent png Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
2d christmas brick wall Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
2d opened christmas crate Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
2d diagonal christmas car or truck in snow Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a christmas poster showcasing miss santa clause Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a single white snowflake Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
2d stacked christmas winter tire Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
2d stacked christmas winter tire Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
2d christmas magical mistletoe Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
2d christmas 357 Magnum bullets Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
2d silhouette of a flying reindeer with a red glowy nose Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
2d christmas dark sparkles Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
2d christmas evil robot elf with a gun 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.
2d pile of gray and red nuts and bolts Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
transparent snow sphere. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
snd_pistol
Sound effect
snd_enemyshot
Sound effect
snd_obstacle
Sound effect
snd_messages
Sound effect
snd_ricochet
Sound effect
snd_reindeer
Sound effect
snd_mistletoe
Sound effect
snd_reindeershot
Sound effect
snd_mistletoeshot
Sound effect
snd_christmasmusic
Music
snd_reload
Sound effect
snd_blastwave
Sound effect