What i want the program to do is draw the graphic ground at each point in which a one appears in the .txt file, but everytime i run it, it doesnt draw the sprite?
here is the code.....
using (StreamReader sr = new StreamReader("trainingLevel.txt"))
{
while (!sr.EndOfStream)
{
string line = sr.ReadLine();
string[] elements = line.Split(',');
foreach (string e in elements)
{
int id = int.Parse(e);
if (id == 1)
{
CreatePlatform(x, y);
}
x += widthPlatform;
}
y += heightPlatform;
x = 0;
}
}
public void CreatePlatform(int x, int y)
{
groundSprite = new Sprite();
groundSprite.Position = new Vector2(x, y);
groundSprite.Load("Ground", Content, simulator);
groundSprite.IsStatic = true;
groundSprite.Geom.OnCollision += OnCollision;
}
protected override void Draw(GameTime gameTime) {
GraphicsDevice.Clear(Color.CornflowerBlue);
spriteBatch.Begin();
List<Sprite> updateDraw = new List<Sprite>();
foreach (Sprite z in updateDraw) {
simulator.Update(gameTime.ElapsedGameTime.Milliseconds * .001f);
z.Update(gameTime);
spriteBatch.Draw(z.CurrentTexture, z.Position, null, Color.White, z.Rotation, z.Origin, 1, SpriteEffects.None, 1);
}
spriteBatch.End();
base.Update(gameTime);
base.Draw(gameTime);
}