User prompt
Create a show paralax effect.
User prompt
the pressent don't go outsite the left and right creen borders
User prompt
make the wiggle random
User prompt
Fix Bug: 'Timeout.tick error: Gift is not defined' in this line: 'var gift = Math.random() < 0.5 ? new Gift() : new RotatingGift();' Line Number: 65
User prompt
To some presents add rotation
User prompt
Add also a slow rotation to the Gift class
User prompt
Add wiggle and rotation on the left and right axis to the Gift Class, the rotation is very slow
User prompt
make the rotation vehavior less
User prompt
also the gift class rottates slightly left and slightly right on their axis as they fall
User prompt
the presents wiggle left and right slowly and they fall
User prompt
when santa is moving increase image size and decrease it a few pixels to simulate movement on a road
User prompt
every time santa moves the image increases, goes back to original size and decrezes followin the movment
User prompt
when santa is moving increase image size and decrease it a few pixels
User prompt
when moving left from the middle of the screen keep image as it is. when changin direction to right flip image
User prompt
Santa spawns at the middle of the screen.
User prompt
then the mouse moves on the right of the screen santa faces right. When the mouse moves on the left santa faces left. If santa is facing left and you move to the left dont flip to the right unless ssanta moves to the right
User prompt
flip the santa image based on the direction of movement.
User prompt
when santa moves right the image faces right and when santa moves left teh image faces left.
User prompt
When santa moves left the santa image faces left. When santa moves right the santa image faces right
User prompt
Presents stay inside on the left and on the right side of the screen
User prompt
The idle postition of the santa image faces left. When moved right it changes direction and faces right. When moves left it changes direction and faces left. The image
User prompt
when santa moves left the image faces left when santa moves right the image faces right
User prompt
Santa should not go outside the screen
User prompt
only 20 per cent of santa image sould be allowed to disapear from the left and right screen borders
User prompt
only one fifth of santa image should be allow to be ouside of the left and right screen border
var GrayHeart = Container.expand(function () { var self = Container.call(this); var grayHeartGraphics = self.createAsset('grayHeart', 'Gray Heart icon', 0, 0); }); var Heart = Container.expand(function () { var self = Container.call(this); var heartGraphics = self.createAsset('heart', 'Heart icon', 0, 0); }); var Santa = Container.expand(function () { var self = Container.call(this); var santaGraphics = self.createAsset('santa', 'Santa character', .5, .5); self.lastX = self.x; self.move = function (newX) { var halfWidth = this.width / 2; var oldX = this.x; this.x = Math.max(halfWidth, Math.min(2048 - halfWidth, newX)); if (oldX > this.x) { this.scale.x = 1; } else if (oldX < this.x) { this.scale.x = -1; } self.lastX = this.x; }; self.collect = function () {}; }); var Gift = Container.expand(function () { var self = Container.call(this); var giftGraphics = self.createAsset('gift', 'Gift item', .5, .5); self.drop = function () { self.y += 5; var deltaX = (Math.random() - 0.5) * 4; self.x = Math.max(self.width / 2, Math.min(2048 - self.width / 2, self.x + deltaX)); }; }); var Game = Container.expand(function () { var self = Container.call(this); var score = 0; var scoreTxt = new Text2(score.toString(), { size: 150, fill: "#ffffff" }); scoreTxt.anchor.set(.5, 0); LK.gui.topCenter.addChild(scoreTxt); var lives = 3; var hearts = []; for (var i = 0; i < lives; i++) { var heart = new Heart(); heart.x = i * (heart.width + 10); heart.y = 10; hearts.push(heart); LK.gui.topLeft.addChild(heart); } var santa = self.addChild(new Santa()); var gifts = []; santa.x = LK.stageContainer.width / 2; santa.y = 2732 - santa.height; var giftCreationInterval = LK.setInterval(function () { var gift = new Gift(); gift.x = Math.random() * 2048; gift.y = 0; gifts.push(gift); self.addChild(gift); }, 2000); LK.on('tick', function () { santa.move(); for (var i = 0; i < gifts.length; i++) { gifts[i].drop(); if (santa.intersects(gifts[i])) { santa.collect(gifts[i]); score++; scoreTxt.setText(score.toString()); gifts[i].destroy(); gifts.splice(i, 1); i--; if (hearts.length > 0) { var lostHeart = hearts[hearts.length - 1]; } } else if (gifts[i].y > 2732) { gifts[i].destroy(); gifts.splice(i, 1); i--; if (--lives <= 0) { if (hearts.length > 0) { var lostHeart = hearts.pop(); lostHeart.destroy(); var grayHeart = new GrayHeart(); grayHeart.x = lostHeart.x; grayHeart.y = lostHeart.y; LK.gui.topLeft.addChild(grayHeart); } LK.showGameOver(); } else if (hearts.length > 0) { var lostHeart = hearts.pop(); lostHeart.destroy(); var grayHeart = new GrayHeart(); grayHeart.x = lostHeart.x; grayHeart.y = lostHeart.y; LK.gui.topLeft.addChild(grayHeart); } } } }); stage.on('down', function (obj) { var pos = obj.event.getLocalPosition(self); santa.move(pos.x); }); stage.on('move', function (obj) { var pos = obj.event.getLocalPosition(self); santa.move(pos.x); }); });
===================================================================
--- original.js
+++ change.js
@@ -27,9 +27,10 @@
var self = Container.call(this);
var giftGraphics = self.createAsset('gift', 'Gift item', .5, .5);
self.drop = function () {
self.y += 5;
- self.x += (Math.random() - 0.5) * 4;
+ var deltaX = (Math.random() - 0.5) * 4;
+ self.x = Math.max(self.width / 2, Math.min(2048 - self.width / 2, self.x + deltaX));
};
});
var Game = Container.expand(function () {
var self = Container.call(this);
Pixelated Santa Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixeled Christmas present Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixalated heart empty Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixalated heart grey Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixelated snow flake Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
snowy ground image pixalated Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
snowy ground image pixalated 2D Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art a small image 2048 to serve as ground that has snow for a simple 2D game no trees not nothing only snow and ground to cover the ground width of the screen Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
gif pixel art for game background, snow on the ground, houses in the far background and moonligh, trees on the left and right, cozy Christmas atmosphere Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.