Wanna know what sucks?
This sucks:
// Background(s) code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
namespace Shooter
{
class ParallaxingBackground
{
// The imag representing the parallaxing background
Texture2D texture;
// An array of positions of the parallaxing background
Vector2[] positions;
// The speed which the background is moving at
int speed;
public void Initialize(ContentManager content, String texturePath, int screenWidth, int speed)
{
// Load the background texture we will be using
texture = content.Load(texturePath);
// Set the speed of the background
this.speed = speed;
// If we divide the screen with the texture width then we can determin the number o tiles we need
// We add 1 to it so that we won't have a gap in the tiling
positions = new Vector2[screenWidth / texture.Width + 1];
// Set the initial positions of the parallaxing background
for (int i = 0; i < positions.Length; i++)
{
// We need the tiles to be side by side to create a tiling effect
positions = new Vector2(i * texture.Width, 0);
}
}
public void Update()
{
// Update the positions of the background
for (int i = 0; i < positions.Length; i++)
{
// Update the position of the screen by adding the speed
positions.X += speed;
// If the speed has the background moving to the left
if (speed <= 0)
{
// Check the texture is out of view then put that texture at the end of the screen
if (positions.X <= texture.Width)
{
positions.X = texture.Width * (positions.Length - 1);
}
// If the speed has the background moving to the right
else
{
// Check if the texture is out of view then position to the start of the screen
if (positions.X >= texture.Width * (positions.Length - 1))
{
positions.X = texture.Width;
}
}
}
}
}
public void Draw(SpriteBatch spriteBatch)
{
spriteBatch.Draw(texture, positions, Color.White);
}
}
}
Followed by: Error: The name 'i' does not exist in the current context
Edit: Excellent, posting it here helped me see the error 







