User prompt
Houses can be naughty (with a red glow), nice (green glow), dark (grey glow), or happy (yellow glow)
User prompt
Houses spawn at a slow rate above the top of the screen and move straight down until they exit the bottom of the screen
User prompt
There is a Joy meter at the top of the screen that requires 8 joy to fill
User prompt
Santa automatically fires presents forward in a straight line. The presents exit the top of the screen and despawn.
User prompt
Remove all code related to presents and to santa firing. Let's start over.
User prompt
The presents still aren't moving, but they should be.
User prompt
Fix the bug where the presents remain stationary after being fired. Instead, they should move forward until they exit the top of the screen and despawn.
User prompt
The presents aren't moving like they should be
User prompt
The presents move forward until they exit the top of the screen and despawn
User prompt
Santa automatically fires Presents forward in a straight line at a slow rate
User prompt
Santa's left right movement is never restricted even when he reaches the forward movement barrier
User prompt
After Santa can no longer move up he still continues to move left or right until he is underneath the location clicked. This does not change the way he moves before his limitations kick in.
User prompt
If Santa is forced to stop moving up due to hitting that movement barrier, he can still move left or right until he's directly underneath the click location
User prompt
When the player clicks on a location that santa cannot move up towards, santa still moves left or right to align at the left/right coordinate clicked on.
User prompt
Santa cannot move above the lower one third of the screen
User prompt
Remove all restrictions on where santa can or cannot move
User prompt
Draw an invisible line 30% up from the bottom of the screen across the screen. Santa cannot pass this line and must stay in the bottom 30% of the screen.
User prompt
Santa cannot move above the lower one third of the screen
User prompt
Santa starts the game 10% above the bottom of the screen in the center
User prompt
Fix Bug: 'TypeError: presents[i].isDelivered is not a function' in this line: 'if (presents[i].isDelivered()) {' Line Number: 75
User prompt
Fix Bug: 'TypeError: presents[i].isDelivered is not a function' in this line: 'if (presents[i].isDelivered()) {' Line Number: 75
User prompt
Santa cannot move above the lower one third of the screen
User prompt
Santa does not teleport, he moves at a reasonable rate to the location tapped or clicked.
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'x')' in this line: 'self.x = position.x;' Line Number: 21
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'x')' in this line: 'self.x = position.x;' Line Number: 21
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 += 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 NaughtyHouse = Container.expand(function () { var self = Container.call(this); var houseGraphics = self.createAsset('naughtyHouse', 'Naughty House Graphics', .5, 1); houseGraphics.tint = 0xff0000; self.speed = 2; self.move = function () { self.y += self.speed; }; }); var NiceHouse = Container.expand(function () { var self = Container.call(this); var houseGraphics = self.createAsset('niceHouse', 'Nice House Graphics', .5, 1); houseGraphics.tint = 0x00ff00; self.speed = 2; self.move = function () { self.y += self.speed; }; }); var DarkHouse = Container.expand(function () { var self = Container.call(this); var houseGraphics = self.createAsset('darkHouse', 'Dark House Graphics', .5, 1); houseGraphics.tint = 0x808080; self.speed = 2; self.move = function () { self.y += self.speed; }; }); var HappyHouse = Container.expand(function () { var self = Container.call(this); var houseGraphics = self.createAsset('happyHouse', 'Happy House Graphics', .5, 1); houseGraphics.tint = 0xffff00; self.speed = 2; self.move = function () { self.y += self.speed; }; }); 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 house = new House(); 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) && !house.getNaughty()) { joyMeter.addJoy(1); 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
@@ -22,23 +22,44 @@
self.move = function () {
self.y += self.speed;
};
});
-var House = Container.expand(function () {
+var NaughtyHouse = Container.expand(function () {
var self = Container.call(this);
- var houseGraphics = self.createAsset('house', 'House Graphics', .5, 1);
- self.isNaughty = false;
+ var houseGraphics = self.createAsset('naughtyHouse', 'Naughty House Graphics', .5, 1);
+ houseGraphics.tint = 0xff0000;
self.speed = 2;
self.move = function () {
self.y += self.speed;
};
- self.setNaughty = function (naughty) {
- self.isNaughty = naughty;
+});
+var NiceHouse = Container.expand(function () {
+ var self = Container.call(this);
+ var houseGraphics = self.createAsset('niceHouse', 'Nice House Graphics', .5, 1);
+ houseGraphics.tint = 0x00ff00;
+ self.speed = 2;
+ self.move = function () {
+ self.y += self.speed;
};
- self.getNaughty = function () {
- return self.isNaughty;
+});
+var DarkHouse = Container.expand(function () {
+ var self = Container.call(this);
+ var houseGraphics = self.createAsset('darkHouse', 'Dark House Graphics', .5, 1);
+ houseGraphics.tint = 0x808080;
+ self.speed = 2;
+ self.move = function () {
+ self.y += self.speed;
};
});
+var HappyHouse = Container.expand(function () {
+ var self = Container.call(this);
+ var houseGraphics = self.createAsset('happyHouse', 'Happy House Graphics', .5, 1);
+ houseGraphics.tint = 0xffff00;
+ self.speed = 2;
+ self.move = function () {
+ self.y += self.speed;
+ };
+});
var Santa = Container.expand(function () {
var self = Container.call(this);
var santaGraphics = self.createAsset('santa', 'Santa Graphics', .5, .5);
self.targetPosition = null;
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.