User prompt
Remove the house move method, and don’t call it in tick
User prompt
After you define isGameOver spawn 8 houses
User prompt
After the spawn house method has been defined, spawn 8 houses
User prompt
Spawn 8 houses after you defined the spawn house method
User prompt
Fix Bug: 'TypeError: self.spawnHouse is not a function. (In 'self.spawnHouse()', 'self.spawnHouse' is undefined)' in this line: 'self.spawnHouse();' Line Number: 25
User prompt
Spawn 8 houses on startup
User prompt
Spawn 8 houses on startup
User prompt
Set new house y, to the last house in the house array minus a random value between 1/3 to 2/3 of the game height
User prompt
Add new method to game that spawns a new house
User prompt
Delete the code that spawns new houses
User prompt
Add a method that spawns the new houses
User prompt
Add a new simple container to game. Just use new Container. This container will contain Santa and houses
User prompt
Add a simple house container
User prompt
Fix Bug: 'TypeError: undefined is not an object (evaluating 'houses[a].move')' in this line: 'houses[a].move();' Line Number: 35
User prompt
Fix Bug: 'TypeError: santa.update is not a function. (In 'santa.update()', 'santa.update' is undefined)' in this line: 'santa.update();' Line Number: 30
Initial prompt
Planet hopper
var Santa = Container.expand(function () { var self = Container.call(this); var santaGraphics = self.createAsset('santa', 'Santa character', .5, .5); self.speed = 5; self.jump = function () {}; self.move = function () {}; }); var House = Container.expand(function () { var self = Container.call(this); var houseGraphics = self.createAsset('house', 'House object', .5, .5); self.speed = -5; }); var Game = Container.expand(function () { var self = Container.call(this); LK.stageContainer.setBackgroundColor(0x000000); var gameContainer = new Container(); self.addChild(gameContainer); var santa = gameContainer.addChild(new Santa()); santa.x = 2048 / 2; santa.y = 2732 / 2; var houses = []; self.spawnHouse = function () { var newHouse = new House(); newHouse.x = 2048; var lastHouseY = houses.length > 0 ? houses[houses.length - 1].y : 2732 / 2; var gameHeightThird = 2732 / 3; newHouse.y = lastHouseY - (Math.random() * (gameHeightThird * 2) + gameHeightThird); houses.push(newHouse); gameContainer.addChild(newHouse); }; var scoreTxt = new Text2('0', { size: 150, fill: "#ffffff" }); scoreTxt.anchor.set(.5, 0); LK.gui.topCenter.addChild(scoreTxt); var isGameOver = false; for (var i = 0; i < 8; i++) { self.spawnHouse(); } var tickOffset = 0; LK.on('tick', function () { if (isGameOver) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } for (var a = houses.length - 1; a >= 0; a--) { if (houses[a].x < -50) { houses[a].destroy(); houses.splice(a, 1); } } }); santa.on('down', function (obj) { santa.jump(); }); });
===================================================================
--- original.js
+++ change.js
@@ -8,11 +8,8 @@
var House = Container.expand(function () {
var self = Container.call(this);
var houseGraphics = self.createAsset('house', 'House object', .5, .5);
self.speed = -5;
- self.move = function () {
- self.x += self.speed;
- };
});
var Game = Container.expand(function () {
var self = Container.call(this);
LK.stageContainer.setBackgroundColor(0x000000);
@@ -47,9 +44,8 @@
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
for (var a = houses.length - 1; a >= 0; a--) {
- houses[a].move();
if (houses[a].x < -50) {
houses[a].destroy();
houses.splice(a, 1);
}
Circular Santa, with gifts on his back. Cartoon. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Perfectly round planet looking like a house, cartoon Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
round house planet, cartoon Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
round house planet, cartoon Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
round house planet, cartoon 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.
round house planet, cartoon Single Game Texture. In-Game asset. 2d. Blank background. High contrast.
round house planet, cartoon Single Game Texture. In-Game asset. 2d. Blank background. High contrast. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Starry Christmas night sky, cartoon, background