User prompt
Fix Bug: 'Uncaught TypeError: requestAnimationFrame is not a function' in this line: 'requestAnimationFrame(gameLoop);' Line Number: 137
User prompt
Fix Bug: 'Uncaught TypeError: requestAnimationFrame is not a function' in this line: 'requestAnimationFrame(gameLoop);' Line Number: 137
User prompt
zorg er voor dat er minder fps drops zijn
User prompt
kan er voor zorgen dat de game geen fps drops meer heeft
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'intersects')' in this line: 'heroBullets.splice(a, 1);' Line Number: 100
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'intersects')' in this line: 'heroBullets.splice(a, 1);' Line Number: 100
User prompt
zorg dat ik de enemy kan killen
User prompt
Fix Bug: 'TypeError: Cannot set properties of undefined (setting 'speed')' in this line: 'self.speed = 4.23;' Line Number: 30
User prompt
Fix Bug: 'TypeError: Cannot set properties of undefined (setting 'speed')' in this line: 'self.speed = 4.23;' Line Number: 30
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'speed')' in this line: 'self.speed = self.speed || 4.23;' Line Number: 30
User prompt
Fix Bug: 'TypeError: Cannot set properties of undefined (setting 'speed')' in this line: 'self.speed = 4.23;' Line Number: 30
User prompt
Fix Bug: 'TypeError: Cannot set properties of undefined (setting 'speed')' in this line: 'self.speed = 4.23;' Line Number: 29
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'expand')' in this line: 'var SmallEnemy = Enemy.expand(function () {' Line Number: 1
User prompt
zorg er voor dat de enemy gekillt kan worden en als hij gekillt is dat er 2 small enemys uit komen die ook op jou afkomen maar 10% sneller zijn
User prompt
Fix Bug: 'TypeError: self.getStage is not a function' in this line: 'var gameContainer = self.getStage();' Line Number: 81
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'addChild')' in this line: 'self.parent.addChild(smallEnemy1);' Line Number: 81
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'addChild')' in this line: 'gameInstance.addChild(smallEnemy1);' Line Number: 81
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'addChild')' in this line: 'self.parent.addChild(smallEnemy1);' Line Number: 81
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'addChild')' in this line: 'gameInstance.addChild(smallEnemy1);' Line Number: 81
User prompt
zorg er voor dat er 2 andere smallenemy uit de enemy komt die je killt
User prompt
zorg er voor dat er 2 andere enemys uit de enemy komt die je killt
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'intersects')' in this line: 'heroBullets.splice(a, 1);' Line Number: 118
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'addChild')' in this line: 'self.parent.addChild(smallEnemy1, smallEnemy2);' Line Number: 72
User prompt
zorg er voor dat ik de enemy kan killen en dat ie dan in 2 splits en dat er 2 kleinere enemys komen
User prompt
Increase the speed of the hero by 10%
var SmallEnemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.createAsset('smallEnemy', 'Small Enemy character', .5, .5); self.followHero = function (hero) { var dx = hero.x - self.x; var dy = hero.y - self.y; var mag = Math.sqrt(dx * dx + dy * dy); self.x += 3.85 * dx / mag; self.y += 3.85 * dy / mag; }; }); var HeroBullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.createAsset('heroBullet', 'Hero Bullet Graphics', .5, .5); self.speed = -10; self.move = function () { self.x += self.speedX; self.y += self.speedY; }; self.timer = LK.setTimeout(function () { self.destroy(); }, 5000); }); var EnemyBullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.createAsset('enemyBullet', 'Enemy Bullet Graphics', .5, .5); self.speed = 10; self.move = function () { self.x += self.speed; }; self.timer = LK.setTimeout(function () { self.destroy(); }, 5000); }); var Hero = Container.expand(function () { var self = Container.call(this); self.update = function () { if (self.dx && self.dy) { self.x -= self.dx; self.y -= self.dy; self.dx *= 0.99; self.dy *= 0.99; if (Math.abs(self.dx) < 0.01 && Math.abs(self.dy) < 0.01) { self.dx = 0; self.dy = 0; } } }; var heroGraphics = self.createAsset('hero', 'Hero character', .5, .5); self.knockback = function (dx, dy) { self.dx = -dx * 116.886; self.dy = -dy * 116.886; }; }); var Enemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.createAsset('enemy', 'Enemy character', .5, .5); self.followHero = function (hero) { var dx = hero.x - self.x; var dy = hero.y - self.y; var mag = Math.sqrt(dx * dx + dy * dy); self.x += 3.85 * dx / mag; self.y += 3.85 * dy / mag; }; self.split = function () { var smallEnemy1 = new SmallEnemy(); smallEnemy1.x = self.x; smallEnemy1.y = self.y; var smallEnemy2 = new SmallEnemy(); smallEnemy2.x = self.x; smallEnemy2.y = self.y; var smallEnemy3 = new SmallEnemy(); smallEnemy3.x = self.x; smallEnemy3.y = self.y; var smallEnemy4 = new SmallEnemy(); smallEnemy4.x = self.x; smallEnemy4.y = self.y; var smallEnemy5 = new SmallEnemy(); smallEnemy5.x = self.x; smallEnemy5.y = self.y; self.parent.addChild(smallEnemy1); self.parent.addChild(smallEnemy2); self.parent.addChild(smallEnemy3); self.parent.addChild(smallEnemy4); self.parent.addChild(smallEnemy5); self.destroy(); }; }); var Game = Container.expand(function () { var self = Container.call(this); LK.stageContainer.setBackgroundColor(0x000000); var hero = self.addChild(new Hero()); var enemy = self.addChild(new Enemy()); hero.x = 1024; hero.y = 1366; enemy.x = 1024; enemy.y = 1366 - 200; var heroBullets = []; var enemyBullets = []; var smallEnemies = []; var isGameOver = false; var tickOffset = 0; var fpsCounter = new Text2('0', { size: 50, fill: '#ffffff' }); LK.gui.topCenter.addChild(fpsCounter); var lastTick = Date.now(); var frameCount = 0; LK.on('tick', function () { if (isGameOver) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } frameCount++; var now = Date.now(); if (now - lastTick >= 1000) { fpsCounter.setText(frameCount); frameCount = 0; lastTick = now; } hero.update(); enemy.followHero(hero); for (var i = 0; i < smallEnemies.length; i++) { smallEnemies[i].followHero(hero); } for (var a = heroBullets.length - 1; a >= 0; a--) { heroBullets[a].move(); if (heroBullets[a].y < -50 || heroBullets[a].y > 2732 + 50 || heroBullets[a].x < -50 || heroBullets[a].x > 2048 + 50) { heroBullets[a].destroy(); heroBullets.splice(a, 1); } else if (heroBullets[a] && heroBullets[a].intersects(enemy)) { enemy.split(); heroBullets[a].destroy(); heroBullets.splice(a, 1); } } for (var a = enemyBullets.length - 1; a >= 0; a--) { if (enemyBullets[a]) { enemyBullets[a].move(); if (enemyBullets[a].y > 2732 + 50) { enemyBullets[a].destroy(); enemyBullets.splice(a, 1); } } } var lastShot = 0; var bulletCount = 0; stage.on('down', function (obj) { var event = obj.event; var pos = event.getLocalPosition(self); var newBullet = new HeroBullet(); newBullet.x = hero.x; newBullet.y = hero.y; var dx = pos.x - hero.x; var dy = pos.y - hero.y; var mag = Math.sqrt(dx * dx + dy * dy); newBullet.speedX = 10 * dx / mag; newBullet.speedY = 10 * dy / mag; heroBullets.push(newBullet); self.addChild(newBullet); hero.knockback(-dx / (mag * 10), -dy / (mag * 10)); }); LK.on('tick', function () { if (bulletCount > 0) bulletCount--; }); }); });
===================================================================
--- original.js
+++ change.js
@@ -61,9 +61,9 @@
var mag = Math.sqrt(dx * dx + dy * dy);
self.x += 3.85 * dx / mag;
self.y += 3.85 * dy / mag;
};
- self.split = function (gameInstance) {
+ self.split = function () {
var smallEnemy1 = new SmallEnemy();
smallEnemy1.x = self.x;
smallEnemy1.y = self.y;
var smallEnemy2 = new SmallEnemy();
@@ -77,13 +77,13 @@
smallEnemy4.y = self.y;
var smallEnemy5 = new SmallEnemy();
smallEnemy5.x = self.x;
smallEnemy5.y = self.y;
- gameInstance.addChild(smallEnemy1);
- gameInstance.addChild(smallEnemy2);
- gameInstance.addChild(smallEnemy3);
- gameInstance.addChild(smallEnemy4);
- gameInstance.addChild(smallEnemy5);
+ self.parent.addChild(smallEnemy1);
+ self.parent.addChild(smallEnemy2);
+ self.parent.addChild(smallEnemy3);
+ self.parent.addChild(smallEnemy4);
+ self.parent.addChild(smallEnemy5);
self.destroy();
};
});
var Game = Container.expand(function () {
watergun Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
water ball Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
water health bar Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
fire Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
blue play button Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
explosion smoke Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.