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%
===================================================================
--- original.js
+++ change.js
@@ -1,4 +1,15 @@
+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;
@@ -50,8 +61,18 @@
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;
+ self.parent.addChild(smallEnemy1, smallEnemy2);
+ self.destroy();
+ };
});
var Game = Container.expand(function () {
var self = Container.call(this);
LK.stageContainer.setBackgroundColor(0x000000);
@@ -62,8 +83,9 @@
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,
@@ -85,13 +107,20 @@
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].intersects(enemy)) {
+ enemy.split();
+ heroBullets[a].destroy();
+ heroBullets.splice(a, 1);
}
}
for (var a = enemyBullets.length - 1; a >= 0; a--) {
if (enemyBullets[a]) {
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.