Steve Tsiki

Steve Tsiki

  • NA
  • 42
  • 0

Draw object from List

Mar 8 2011 6:05 AM
Hello to everybody.

I'm facing a problem in my code. I have created a class called Obstacles and in my main code I created this function:
        public void o_value(Object o, EventArgs e) // Function to change bool and insert Object Obtacle
        {
            obstacle_pressed = true;
            obstacles.Add(new Obstacle(new Rectangle(300, 300, 30, 60),Content.Load<Texture2D>("Obstacles/default")));
        }
Then in my Draw function I do as followed:
                    if (obstacle_pressed == true)
                    {
                        foreach (Obstacle obstacle in obstacles)
                        {
                            obstacle.Draw(spriteBatch); // I have created a function Draw in Obstacles Class
                        }
                    }
But nothing is shown in my Game!
Could anyone please help?
Thanks

Answers (9)