User prompt
Take 1 life from player at collisions BY ROOF and remove a santa's face from the life counter
User prompt
ENSURE THAT PLAYER HAS 3 LIVES AT GAME START AND TAKE 1 LIVE FROM THEM AT COLLISIONS. Add 3 santa's face to UPPER RIGHT a lifecounter on the map
User prompt
add 3 santa's face to UPPER RIGHT a lifecounter on the map ENSURE THAT santaSleigh HAS 3 LIVES AT GAME START AND TAKE 1 LIVE FROM THEM AT COLLISIONS
User prompt
THIS WAS YOUR FAULT SO REPAIR THIS TO 1TAKE JUST 1 LIVE AT COLLISION
User prompt
you did itt wrong. you take 2 live at once but you should take just 1 live when santaSleigh touch roof asset
User prompt
Remove one life from the life counter when santaSleigh touches one of them a roof asset
User prompt
Remove one life from the life counter when santaSleigh touches a roof asset
User prompt
DO YOU UNDERSTAND? THE PLAYER HAS 3 LIVES AT THE GAME START!!! Take only 1 live from the 3 when the santaSleigh touch the roof asset
User prompt
ENSURE THAT PLAYER HAS 3 LIVES IN THE GAME. Remove ONLY one life from the life counter when santaSleigh touches a roof.
User prompt
take one head from the lifecounter when santaSleigh goes to the roof asset
User prompt
fix it
User prompt
ake a head from the lifecounter when that santaSleigh goes to the roof asset
User prompt
1 head = one life. if all three are used up, it's game over
User prompt
take a head from the lifecounter when that santaSleigh goes to the roof asset
User prompt
add Santa's face assets to the upper right of the map
User prompt
add 3 santa's face to a lifecounter on the map
User prompt
Drop gift when santaSleigh is toward a roof asset
User prompt
Please fix the bug: 'TypeError: gifts[l] is undefined' in or related to this line: 'gifts[l].update();' Line Number: 180
User prompt
repair this gift bug
User prompt
Drop gift only when santaSleigh is toward of a roof asset
User prompt
ONLY DROP GIFT ASSET ONTO A ROOF WHEN THE santaSleigh is above the roof
User prompt
Add gift to the map
User prompt
Add gift to the map
User prompt
drop gift asset onto the roof asset when santaSleigh asset's over it
User prompt
drop gift asset onto the roof asset
/**** * Classes ****/ // Airplane class var Airplane = Container.expand(function () { var self = Container.call(this); var airplaneGraphics = self.attachAsset('airplane', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -5; self.update = function () { self.x += self.speed; if (self.x < -airplaneGraphics.width / 2) { self.x = 2048 + airplaneGraphics.width / 2; } }; }); // Gift class var Gift = Container.expand(function () { var self = Container.call(this); var giftGraphics = self.attachAsset('gift', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 5; self.update = function () { self.y += self.speed; }; }); // LifeCounter class var LifeCounter = Container.expand(function () { var self = Container.call(this); for (var i = 0; i < 3; i++) { var santaFace = self.attachAsset('santaFace', { anchorX: 0.0, anchorY: 0.0, x: i * 110 }); } }); // Roof class var Roof = Container.expand(function () { var self = Container.call(this); var roofGraphics = self.attachAsset('roof', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -5; self.update = function () { self.x += self.speed; if (self.x < -roofGraphics.width / 2) { self.x = 2048 + roofGraphics.width / 2; } }; }); //<Assets used in the game will automatically appear here> //<Write imports for supported plugins here> // Santa's Sleigh class var SantaSleigh = Container.expand(function () { var self = Container.call(this); var sleighGraphics = self.attachAsset('santaSleigh', { anchorX: 0.5, anchorY: 0.5 }); self.velocity = 0; self.gravity = 0.5; self.lift = -10; self.update = function () { self.velocity += self.gravity; self.y += self.velocity; if (self.y > 2732 - sleighGraphics.height / 2) { self.y = 2732 - sleighGraphics.height / 2; self.velocity = 0; } if (self.y < sleighGraphics.height / 2) { self.y = sleighGraphics.height / 2; self.velocity = 0; } }; self.flap = function () { self.velocity = self.lift; }; self.dropGift = function () { var gift = new Gift(); gift.x = self.x; gift.y = self.y; game.addChild(gift); }; }); // Snowflake class var Snowflake = Container.expand(function () { var self = Container.call(this); var snowflakeGraphics = self.attachAsset('snowflake', { anchorX: 0.5, anchorY: 0.5 }); self.speed = Math.random() * 2 + 1; // Random speed between 1 and 3 self.update = function () { self.y += self.speed; if (self.y > 2732 + snowflakeGraphics.height / 2) { self.y = -snowflakeGraphics.height / 2; self.x = Math.random() * 2048; // Random x-coordinate } }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 // Black background }); /**** * Game Code ****/ var wallpaper = game.attachAsset('wallpaper', { anchorX: 0.0, anchorY: 0.0 }); var lifeCounter = game.addChild(new LifeCounter()); lifeCounter.x = 2048 - lifeCounter.width - 20; lifeCounter.y = 20; // Initialize game elements var santaSleigh = game.addChild(new SantaSleigh()); santaSleigh.x = 400; santaSleigh.y = 1366; // Center vertically var roofs = []; var airplanes = []; // Create roof var roof = new Roof(); roof.x = 2048; roof.y = 2732 - 100; // Bottom of the screen roofs.push(roof); game.addChild(roof); // Initialize snowflakes var snowflakes = []; for (var i = 0; i < 100; i++) { // Create 100 snowflakes var snowflake = new Snowflake(); snowflake.x = Math.random() * 2048; // Random x-coordinate snowflake.y = Math.random() * 2732; // Random y-coordinate snowflakes.push(snowflake); game.addChild(snowflake); } // Create airplane var airplane = new Airplane(); airplane.x = 2048; airplane.y = Math.random() * (1366 - 200) + 200; // Randomize y-coordinate in the upper half of the screen airplanes.push(airplane); game.addChild(airplane); // Handle game events game.down = function (x, y, obj) { santaSleigh.flap(); }; // Update game state var gifts = []; game.update = function () { santaSleigh.update(); for (var i = 0; i < roofs.length; i++) { roofs[i].update(); if (santaSleigh.intersects(roofs[i])) { santaSleigh.dropGift(); // Remove one life from the life counter if (lifeCounter.children.length > 0) { lifeCounter.removeChildAt(lifeCounter.children.length - 1); } // Check if all lives are lost if (lifeCounter.children.length == 0) { // Flash screen red for 1 second (1000ms) to show we are dead. LK.effects.flashScreen(0xff0000, 1000); // Show game over. The game will be automatically paused while game over is showing. LK.showGameOver(); // Calling this will destroy the 'Game' and reset entire game state. } } } for (var j = 0; j < airplanes.length; j++) { airplanes[j].update(); if (santaSleigh.intersects(airplanes[j])) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } // Play airplane sound when the airplane is on the map LK.getSound('Airplane').play(); } for (var k = 0; k < snowflakes.length; k++) { snowflakes[k].update(); } for (var l = 0; l < gifts.length; l++) { gifts[l].update(); if (gifts[l].y > 2732) { gifts[l].destroy(); gifts.splice(l, 1); } } };
===================================================================
--- original.js
+++ change.js
@@ -162,9 +162,9 @@
roofs[i].update();
if (santaSleigh.intersects(roofs[i])) {
santaSleigh.dropGift();
// Remove one life from the life counter
- if (lifeCounter.children.length > 1) {
+ if (lifeCounter.children.length > 0) {
lifeCounter.removeChildAt(lifeCounter.children.length - 1);
}
// Check if all lives are lost
if (lifeCounter.children.length == 0) {
Santa's sleigh with reindeers. profile view
Air coaching airplane at night, from profile view
snowflake
Photorealistic office house at New york night from front view.
Photorealistic and ultrawide panoramic landscape from New york at night.
gift package with christmas decor
Santa's face. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.