Skip to content

Feature/vampire survivor movement#2

Merged
ednark merged 2 commits into
masterfrom
feature/vampire-survivor-movement
Mar 7, 2026
Merged

Feature/vampire survivor movement#2
ednark merged 2 commits into
masterfrom
feature/vampire-survivor-movement

Conversation

@ednark
Copy link
Copy Markdown
Owner

@ednark ednark commented Mar 7, 2026

No description provided.

@ghost
Copy link
Copy Markdown

ghost commented Mar 7, 2026

Rooviewer Clock   See task

Review completed. Found 3 issues that should be addressed:

  • Projectiles use stale enemy positions and miss moving targets
  • Enemy collision with player incorrectly increments kill counter instead of damaging player
  • Potential array modification issues when multiple projectiles hit the same enemy

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@ednark ednark merged commit ddcd4d2 into master Mar 7, 2026
1 check passed
@ednark ednark deleted the feature/vampire-survivor-movement branch March 7, 2026 18:47
Comment on lines +429 to +448
// Fire projectile at nearest enemy
function fireProjectile() {
const nearestEnemy = findNearestEnemy();
if (!nearestEnemy) return;

const startX = game.player.x + game.player.size / 2;
const startY = game.player.y + game.player.size / 2;
const targetX = nearestEnemy.x + nearestEnemy.size / 2;
const targetY = nearestEnemy.y + nearestEnemy.size / 2;

const projectile = new Projectile(
startX,
startY,
targetX,
targetY,
game.weaponSystem.projectileSpeed
);

game.projectiles.push(projectile);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Projectiles use the enemy's position at fire time and continue in that direction, which causes them to miss moving targets. Since enemies are constantly moving toward the player, projectiles will often miss at medium to long range. Consider implementing homing projectiles that update their direction each frame, or use predictive targeting that aims at where the enemy will be.

Fix it with Roo Code or mention @roomote and request a fix.

Comment on lines +735 to +739
if (collided) {
// Enemy reached player - remove it and count as kill
game.enemies.splice(i, 1);
game.stats.kills++;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When an enemy collides with the player, it's removed and counted as a kill. This is semantically incorrect for a vampire survivor game where enemies touching the player should damage the player, not reward them with a kill. The kill counter should only increment when projectiles destroy enemies.

Fix it with Roo Code or mention @roomote and request a fix.

Comment on lines +706 to +718
// Check collision with enemies
for (let j = game.enemies.length - 1; j >= 0; j--) {
const enemy = game.enemies[j];
if (projectile.checkCollision(enemy)) {
projectile.alive = false;
const died = enemy.takeDamage(game.weaponSystem.damage);
if (died) {
game.enemies.splice(j, 1);
game.stats.kills++;
}
break;
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modifying the game.enemies array while iterating through projectiles can cause issues. If multiple projectiles hit the same enemy in a single frame, the first hit removes the enemy from the array (line 713), but subsequent projectiles may still try to check collision with it. While the current code uses break to exit the inner loop, this pattern is fragile. Consider marking enemies for removal and cleaning them up after both loops complete, or iterate backwards through the enemies array.

Fix it with Roo Code or mention @roomote and request a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants