User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'move')' in this line: 'zombieKids[b].move();' Line Number: 47
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'move')' in this line: 'zombieKids[b].move();' Line Number: 45
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'move')' in this line: 'snowballs[a].move();' Line Number: 38
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'move')' in this line: 'snowballs[a].move();' Line Number: 38
Initial prompt
Snowball Santa
var Snowball = Container.expand(function () { var self = Container.call(this); var snowballGraphics = self.createAsset('snowball', 'Snowball Graphics', .5, .5); self.speed = -5; self.move = function () { self.x += self.speed; }; }); var ZombieKid = Container.expand(function () { var self = Container.call(this); var zombieKidGraphics = self.createAsset('zombieKid', 'Zombie Kid Graphics', .5, .5); self.speed = 1; self.move = function () { self.x += self.speed; }; }); var Santa = Container.expand(function () { var self = Container.call(this); var santaGraphics = self.createAsset('santa', 'Santa Graphics', .5, .5); }); var Game = Container.expand(function () { var self = Container.call(this); LK.stageContainer.setBackgroundColor(0x008080); var santa = self.addChild(new Santa()); santa.x = 2048 / 2; santa.y = 2732 - santa.height; var snowballs = []; var zombieKids = []; santa.on('down', function (obj) { var newSnowball = new Snowball(); newSnowball.x = santa.x; newSnowball.y = santa.y; snowballs.push(newSnowball); self.addChild(newSnowball); }); LK.on('tick', function () { for (var a = snowballs.length - 1; a >= 0; a--) { if (snowballs[a]) { snowballs[a].move(); if (snowballs[a].y < -50) { snowballs[a].destroy(); snowballs.splice(a, 1); } } } for (var b = zombieKids.length - 1; b >= 0; b--) { zombieKids[b].move(); if (zombieKids[b].x > 2048) { zombieKids[b].destroy(); zombieKids.splice(b, 1); } } if (LK.ticks % 60 == 0) { var newZombieKid = new ZombieKid(); newZombieKid.x = 0; newZombieKid.y = Math.random() * (2732 - newZombieKid.height); zombieKids.push(newZombieKid); self.addChild(newZombieKid); } }); });
===================================================================
--- original.js
+++ change.js
@@ -42,9 +42,9 @@
snowballs.splice(a, 1);
}
}
}
- for (var b = zombieKids.length; b >= 0; b--) {
+ for (var b = zombieKids.length - 1; b >= 0; b--) {
zombieKids[b].move();
if (zombieKids[b].x > 2048) {
zombieKids[b].destroy();
zombieKids.splice(b, 1);
a christmas gift Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
red crosshair Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
snowball of soft snow Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Christmas gift with glowing green wrapping paper Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a christmas gift in beautiful glowing wrapping paper Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Christmas gift beautifully wrapped in green glowing wrapping paper Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Snowy flat surface viewed from above at nighttime Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
an empty painting with a winter styled frame Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a kid thief in wearing a black hoodie. Also looking like a zombie Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A button with the text "play". Winter theme Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A winter themed button, with no text Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A buy upgrade button, winter theme, no text Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a wide white sheet of paper Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a snowball Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a snowball
A game over screen for the game "Snowball Santa". Santa is very sad because all the presents has been stolen from ninja kids. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A wooden sign with text "UPGRADES" in a winter theme. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A ninja kid thief, full body, with a dark purple hoodie. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A ninja kid thief, full body, with a dark colored hoodie. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A ninja kid thief, full body, with a dark colored hoodie. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a precious colorful glowing gem with snow and ice on it. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a logo for the game "Snowball santa" with the text "Snowball Santa". Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A beautiful winter snowy christmas landscape with ninja thieves kids lurking. Christmas gifts are hidden in the snow. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.