User prompt
every time rudolph spawns it should start moving in circles
User prompt
rudolph should move in cirles once he spawns
User prompt
rudolph should spawn randomly anywhere in the top half of the screen
User prompt
rudolph should spawn in the center of the screen
User prompt
rudolph should move from the right to the left of the screen
User prompt
update rudolph spawn and movement. it should spawn and move randomly on the top half of the screen
User prompt
when santa collides with rudolph, present count should go to 10 and rudolph should be destroyed
User prompt
rudolph should not appear on game start
User prompt
rudolph should only appear when present count is 0
User prompt
rudolph should appear when present count is 0
User prompt
rudolph should apprear on game start
User prompt
there should always be one rudolph on the screen
User prompt
spawn rudolph on the right on the top half of the screen with movement towards the left
User prompt
delete rudolph
User prompt
update present count to 10 when santa collides with rudolph
User prompt
when player collides with rudolp present count should go up to 10
User prompt
rudolph should move randomly all arround the top half of the screen
User prompt
decrese present counter to 10
User prompt
rudolph should move randomly on the top halp of the screen
User prompt
Fix Bug: 'ReferenceError: rudolph is not defined' in this line: 'if (rudolph.intersects(santa)) {' Line Number: 217
User prompt
rudolph should allways be visible
User prompt
show rudolph in the center of the screen when the game starts
User prompt
show rudolph on game start
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'move')' in this line: 'this.rudolph.move();' Line Number: 220
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'move')' in this line: 'rudolph.move();' Line Number: 220
var Rudolph = Container.expand(function () {
var self = Container.call(this);
var rudolphGraphics = self.createAsset('rudolph', 'Rudolph character', 0.5, 0.5);
self.active = false;
self.speed = 5;
self.move = function () {
var maxY = LK.gui.topCenter.y + LK.gui.topCenter.height;
var minY = 0;
var maxX = 2048;
var minX = 0;
self.y += Math.random() * 10 - 5;
self.x += Math.random() * 10 - 5;
self.y = Math.max(minY, Math.min(self.y, 2732));
self.x = Math.max(minX, Math.min(self.x, 2048));
};
});
var LifeIcon = Container.expand(function () {
var self = Container.call(this);
var lifeIconGraphics = self.createAsset('lifeIcon', 'Life Icon', 0.5, 0.5);
});
var Star = Container.expand(function () {
var self = Container.call(this);
var starGraphics = self.createAsset('star', 'Star', 0.5, 0.5);
self.speed = 2 + Math.random() * 3;
self.move = function () {
self.x -= self.speed;
if (self.x < -self.width) {
self.destroy();
}
};
});
var Santa = Container.expand(function () {
var self = Container.call(this);
self.resetPresents = function () {
this.presentCounter = 20;
this.parent.presentCounterTxt.setText(this.presentCounter.toString());
};
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 () {
if (this.presentCounter > 0) {
var present = new Present();
present.x = this.x;
present.y = this.y;
this.parent.addChild(present);
this.parent.presents.push(present);
this.presentCounter--;
this.parent.presentCounterTxt.setText(this.presentCounter.toString());
}
};
});
var Present = Container.expand(function () {
var self = Container.call(this);
var presentGraphics = self.createAsset('present', 'Present', .5, .5);
self.move = function (hazards) {
this.y += 5;
hazards.forEach((function (hazard) {
if (this.intersects(hazard)) {
this.destroy();
}
}).bind(this));
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.originalTint = 0xFFFFFF;
self.presentDeliveredTint = 0x00FF00;
self.hasPresent = false;
self.speed = 2;
self.move = function () {
self.x -= self.speed;
if (self.x < -self.width) {
self.destroy();
}
};
self.checkCollision = function () {};
});
var Hazard = Container.expand(function () {
var self = Container.call(this);
var hazardGraphics = self.createAsset('hazard', 'Hazard', .5, .5);
self.move = function () {
self.x -= self.speed;
if (self.x < -self.width) {
self.destroy();
}
};
});
var Game = Container.expand(function () {
var self = Container.call(this);
self.stars = [];
var starSpawnRate = 15;
var starSpawnCounter = 0;
var santa = self.addChild(new Santa());
santa.x = 2048 / 2;
santa.y = 0;
santa.lives = 3;
self.lifeIcons = [];
for (var i = 0; i < santa.lives; i++) {
var lifeIcon = new LifeIcon();
lifeIcon.x = 10 + i * (lifeIcon.width + 10);
lifeIcon.y = 10;
self.lifeIcons.push(lifeIcon);
LK.gui.topLeft.addChild(lifeIcon);
}
santa.presentCounter = 20;
this.rudolph = self.addChild(new Rudolph());
this.rudolph.x = 2048 / 2;
this.rudolph.y = 0;
this.rudolph.active = false;
this.rudolph.visible = false;
self.presents = [];
var chimneys = [];
var hazards = [];
var hazardSpeed = 5;
var hazardSpawnRate = 120;
var hazardSpawnCounter = 0;
var scoreTxt = new Text2('0', {
size: 150,
fill: "#ffffff"
});
var presentIcon = self.createAsset('presentIcon', 'Present Icon', 0.5, 0);
presentIcon.x = 10;
presentIcon.y = 10 + santa.lives * (lifeIcon.height + 10) - 200;
LK.gui.topLeft.addChild(presentIcon);
var presentCounterTxt = new Text2(santa.presentCounter.toString(), {
size: 100,
fill: "#ffffff"
});
presentCounterTxt.x = presentIcon.x + presentIcon.width + 10;
presentCounterTxt.y = presentIcon.y;
self.presentCounterTxt = presentCounterTxt;
LK.gui.topLeft.addChild(presentCounterTxt);
var maxChimneys = 5;
LK.on('tick', function () {
if (starSpawnCounter++ >= starSpawnRate) {
var newStar = new Star();
newStar.x = 2048;
newStar.y = Math.random() * (2732 * 0.8);
self.stars.push(newStar);
self.addChild(newStar);
starSpawnCounter = 0;
}
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();
self.presents.forEach(function (present, index) {
if (present.intersects(chimney) && !chimney.hasPresent) {
present.destroy();
self.presents.splice(index, 1);
chimney.hasPresent = true;
chimney.tint = chimney.presentDeliveredTint;
var newScore = LK.getScore() + 1;
LK.setScore(newScore);
scoreTxt.setText(newScore.toString());
}
});
});
chimneys = chimneys.filter(function (chimney) {
return chimney.x + chimney.width > 0;
});
});
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(hazards);
}
for (var i = 0; i < chimneys.length; i++) {
chimneys[i].checkCollision();
}
if (hazardSpawnCounter++ >= hazardSpawnRate) {
var newHazard = new Hazard();
newHazard.x = 2048;
newHazard.y = Math.random() * (2732 * 0.8);
newHazard.speed = hazardSpeed;
hazards.push(newHazard);
self.addChild(newHazard);
hazardSpawnCounter = 0;
}
hazards.forEach(function (hazard) {
hazard.move();
});
var santaHit = false;
hazards.forEach(function (hazard, index) {
if (!santaHit && santa.intersects(hazard)) {
hazard.destroy();
hazards.splice(index, 1);
santaHit = true;
santa.lives--;
if (self.lifeIcons.length > santa.lives) {
var removedLifeIcon = self.lifeIcons.pop();
removedLifeIcon.destroy();
}
if (santa.lives <= 0) {
LK.showGameOver();
}
if (this.presentCounter === 0) {
var rudolph = this.parent.addChild(new Rudolph());
rudolph.x = 2048 / 2;
rudolph.y = 2732 * 0.8;
rudolph.active = true;
rudolph.visible = true;
}
this.rudolph.move();
if (rudolph.intersects(santa)) {
santa.presentCounter += 20;
self.presentCounterTxt.setText(santa.presentCounter.toString());
rudolph.destroy();
}
}
});
hazards = hazards.filter(function (hazard) {
return !hazard._destroyed;
});
hazards = hazards.filter(function (hazard) {
return !hazard.hitSanta;
});
self.stars.forEach(function (star) {
star.move();
});
self.stars = self.stars.filter(function (star) {
return !star._destroyed;
});
hazards = hazards.filter(function (hazard) {
return !hazard._destroyed;
});
});
stage.on('move', function (obj) {
var pos = obj.event.getLocalPosition(self);
if (pos.y < 2732 * 0.8) {
santa.move(pos);
}
});
stage.on('up', function (obj) {
santa.throwPresent();
});
});
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.