User prompt
zorg er voor dat na de seconde de animatie verdwijnt
User prompt
Fix Bug: 'Timeout.tick error: Cannot read properties of undefined (reading 'destroy')' in this line: 'enemies[e].destroy();' Line Number: 174
User prompt
Fix Bug: 'Timeout.tick error: Cannot read properties of undefined (reading 'destroy')' in this line: 'enemies[e].destroy();' Line Number: 174
User prompt
ik wil dat er een animatie komt na dat ik de enemys kill
User prompt
Fix Bug: 'ReferenceError: bottomWall is not defined' in this line: 'if (hero.y > 2732 - bottomWall.height - 0.025 * 2732) hero.y = 2732 - bottomWall.height - 0.025 * 2732;' Line Number: 154
User prompt
Fix Bug: 'ReferenceError: topWall is not defined' in this line: 'if (hero.y < topWall.height + 0.025 * 2732) hero.y = topWall.height + 0.025 * 2732;' Line Number: 152
User prompt
Fix Bug: 'ReferenceError: rightWall is not defined' in this line: 'if (hero.x > 2048 - rightWall.width - 0.025 * 2048) hero.x = 2048 - rightWall.width - 0.025 * 2048;' Line Number: 151
User prompt
Fix Bug: 'ReferenceError: leftWall is not defined' in this line: 'if (hero.x < leftWall.width + 0.025 * 2048) hero.x = leftWall.width + 0.025 * 2048;' Line Number: 150
User prompt
zorg dat aan elke kant de walls iets meer naar het midden dikker wordt
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'intersects')' in this line: 'if (heroBullets[a].intersects(enemies[e])) {' Line Number: 170
User prompt
Remove enemy when hit by hero bullet
User prompt
zorg dat de enemys wordt verwijdert van als je ze raakt met de bullet
User prompt
zorg dat je damage kan doen met de bullets voor op de enemys
User prompt
make sure you can kill the enemy and that the bigger ones have to take 2 hits before they are dead
User prompt
zorg dat groter enemys meer bullets moeten ontvangen voor dat ze dood gaan
User prompt
spawn random verschillende grotes enemys
User prompt
na elke bullet moet er geen kans meer zijn om direct een bullet af af te schieten
User prompt
touch time delay with 10 seconds
User prompt
waarom kan ik geen manier vinden die er voorzorgt dat er veel seconde tussen het aan raken van het scherm zit
User prompt
Progress development I want the bullet system to work better, such as not shooting so often in a row and adding more physics, but do not remove the current system, but you can remove things that do not add anything
User prompt
zorg dat de hero maar 1 bullet per halve second kan gebruiken
User prompt
ik kan nog steeds zo vaak drukken zo als ik wil maar ik wil een delay tussen elke bullet hebben
User prompt
/** Limit bullet firing rate to 1 bullet per half second **/ //Replace this 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)); if (dx < 0) { hero.scale.x = 1; } else { hero.scale.x = -1; } }); //Replace width var lastBulletTime = 0; stage.on('down', function (obj) { var now = Date.now(); if (now - lastBulletTime < 500) return; lastBulletTime = now; 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)); if (dx < 0) { hero.scale.x = 1; } else { hero.scale.x = -1; } });
User prompt
Change bullet cooldown to 7000 seconds
User prompt
Limit bullet firing rate to 1 bullet per half second
var Wall = Container.expand(function () { var self = Container.call(this); self.createAsset('wall', 'Wall', 0, 0); self.isBarrier = true; }); 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.95; self.dy *= 0.95; 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); heroGraphics.rotation = 42 * (Math.PI / 180); self.knockback = function (dx, dy) { self.dx = -dx * 116.886 * 3.645; self.dy = -dy * 116.886 * 3.645; }; }); var Enemy = Container.expand(function () { var self = Container.call(this); self.graphics = 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; }; }); var Game = Container.expand(function () { var self = Container.call(this); LK.stageContainer.setBackgroundColor(0x000000); var hero = self.addChild(new Hero()); var enemies = []; hero.x = 1024; hero.y = 1366; var leftWallTop = self.addChild(new Wall()); leftWallTop.width = 40.96; leftWallTop.height = 1366; leftWallTop.x = 0; leftWallTop.y = 0; var leftWallBottom = self.addChild(new Wall()); leftWallBottom.width = 81.92; leftWallBottom.height = 1366; leftWallBottom.x = 0; leftWallBottom.y = 1366; var rightWallTop = self.addChild(new Wall()); rightWallTop.width = 40.96; rightWallTop.height = 1366; rightWallTop.x = 2048 - 40.96; rightWallTop.y = 0; var rightWallBottom = self.addChild(new Wall()); rightWallBottom.width = 81.92; rightWallBottom.height = 1366; rightWallBottom.x = 2048 - 81.92; rightWallBottom.y = 1366; var topWallLeft = self.addChild(new Wall()); topWallLeft.width = 1024; topWallLeft.height = 54.64; topWallLeft.x = 0; topWallLeft.y = 0; var topWallRight = self.addChild(new Wall()); topWallRight.width = 1024; topWallRight.height = 109.28; topWallRight.x = 1024; topWallRight.y = 0; var bottomWallLeft = self.addChild(new Wall()); bottomWallLeft.width = 1024; bottomWallLeft.height = 54.64; bottomWallLeft.x = 0; bottomWallLeft.y = 2732 - 54.64; var bottomWallRight = self.addChild(new Wall()); bottomWallRight.width = 1024; bottomWallRight.height = 109.28; bottomWallRight.x = 1024; bottomWallRight.y = 2732 - 109.28; var spawnEnemy = function () { var newEnemy = self.addChild(new Enemy()); newEnemy.x = Math.random() * 2048; newEnemy.y = Math.random() * 2732; newEnemy.scale.x = newEnemy.scale.y = Math.random() * 2 + 0.5; enemies.push(newEnemy); }; spawnEnemy(); var enemySpawnInterval = LK.setInterval(spawnEnemy, 7000); var heroBullets = []; var enemyBullets = []; var isGameOver = false; var tickOffset = 0; var fpsCounter = new Text2('0', { size: 50, fill: '#ffffff' }); LK.gui.topCenter.addChild(fpsCounter); var gameTimerCounter = new Text2('0', { size: 50, fill: '#ffffff' }); gameTimerCounter.x = -50; LK.gui.topRight.addChild(gameTimerCounter); var gameStartTime = Date.now(); 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; var gameElapsedTime = Math.floor((Date.now() - gameStartTime) / 1000); gameTimerCounter.setText(gameElapsedTime.toString()); } hero.update(); if (hero.x < leftWallTop.width + 0.025 * 2048) hero.x = leftWallTop.width + 0.025 * 2048; if (hero.x > 2048 - rightWallTop.width - 0.025 * 2048) hero.x = 2048 - rightWallTop.width - 0.025 * 2048; if (hero.y < topWallLeft.height + 0.025 * 2732) hero.y = topWallLeft.height + 0.025 * 2732; if (hero.y < topWallRight.height + 0.025 * 2732) hero.y = topWallRight.height + 0.025 * 2732; if (hero.y > 2732 - bottomWall.height - 0.025 * 2732) hero.y = 2732 - bottomWall.height - 0.025 * 2732; enemies.forEach(function (enemy, index) { enemy.followHero(hero); for (var i = 0; i < enemies.length; i++) { if (i !== index) { var other = enemies[i]; var dx = enemy.x - other.x; var dy = enemy.y - other.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < enemy.graphics.width) { var overlap = enemy.graphics.width - distance; var adjustX = overlap / 2 * (dx / distance); var adjustY = overlap / 2 * (dy / distance); enemy.x += adjustX; enemy.y += adjustY; other.x -= adjustX; other.y -= adjustY; } } } }); for (var a = heroBullets.length - 1; a >= 0; a--) { heroBullets[a].move(); if (heroBullets[a].y < 0 || heroBullets[a].y > 2732 || heroBullets[a].x < 0 || heroBullets[a].x > 2048) { heroBullets[a].destroy(); heroBullets.splice(a, 1); } for (var b = enemyBullets.length - 1; b >= 0; b--) { if (heroBullets[a].intersects(enemyBullets[b])) { heroBullets[a].destroy(); enemyBullets[b].destroy(); heroBullets.splice(a, 1); enemyBullets.splice(b, 1); break; } } for (var e = enemies.length - 1; e >= 0; e--) { if (heroBullets[a] && enemies[e] && heroBullets[a].intersects(enemies[e])) { heroBullets[a].destroy(); enemies[e].destroy(); heroBullets.splice(a, 1); enemies.splice(e, 1); break; } } } 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 lastBulletTime = 0; var bulletFireRate = 1000; var lastBulletTime = 0; var bulletFireRate = 500; var lastBulletTime = 0; var lastTouchTime = 0; var touchDelay = 10000; stage.on('down', function (obj) { var now = Date.now(); if (now - lastTouchTime < touchDelay) return; lastTouchTime = now; if (now - lastBulletTime < bulletFireRate) return; lastBulletTime = now; 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)); if (dx < 0) { hero.scale.x = 1; } else { hero.scale.x = -1; } }); }); });
===================================================================
--- original.js
+++ change.js
@@ -148,9 +148,10 @@
}
hero.update();
if (hero.x < leftWallTop.width + 0.025 * 2048) hero.x = leftWallTop.width + 0.025 * 2048;
if (hero.x > 2048 - rightWallTop.width - 0.025 * 2048) hero.x = 2048 - rightWallTop.width - 0.025 * 2048;
- if (hero.y < topWall.height + 0.025 * 2732) hero.y = topWall.height + 0.025 * 2732;
+ if (hero.y < topWallLeft.height + 0.025 * 2732) hero.y = topWallLeft.height + 0.025 * 2732;
+ if (hero.y < topWallRight.height + 0.025 * 2732) hero.y = topWallRight.height + 0.025 * 2732;
if (hero.y > 2732 - bottomWall.height - 0.025 * 2732) hero.y = 2732 - bottomWall.height - 0.025 * 2732;
enemies.forEach(function (enemy, index) {
enemy.followHero(hero);
for (var i = 0; i < enemies.length; i++) {
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.