Scoville Units Unite

20 Jun

Horrible code

Going through an XNA tutorial I came across this:

[code lang="csharp"]
protected void CheckBulletHits()
{
// Check to see of any of the players bullets have
// impacted any of the enemies.
for (int i = 0; i < iMaxBullets; i++)
{
if (bullets[i].IsActive)
for (int x = 0; x < iTotalMaxEnemies; x++)
if (Enemies[x].IsActive)
if  (Intersects(bullets[i].BoundingBox, Enemies[x].CollisionBox))
{
DestroyEnemy(x);
RemoveBullet(x);
}
}
}
[/code]

Curly braces exist for a reason. (also WordPress displays code blocks crap, had to nest them, time to look for a plugin). Edit – found.

Leave a Reply

© 2024 Scoville Units Unite | Entries (RSS) and Comments (RSS)

Powered by Wordpress, design by Web4 Sudoku, based on Pinkline by GPS Gazette