Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualTubbly

Posted 28 December 2012 - 06:27 PM

I'm trying to spawn a new enemy in my game, I've been following a book to do this :

 

public void LoadEnemies()                {                    int randY = random.Next(100,400);                    if (spawnzz >= 1)                    {                        spawnzz = 0;                        if (enemies.Count < 4)                        {                            enemies.Add(new EnemySpawn(Content.Load("Graphics/Sprites/enemy"), new Vector2(1100, randY)));                        }                    }                    for (int i = 0; i < enemies.Count; i++)                    {                        if (!enemies[i].isVisible)                        {                            enemies.RemoveAt(i);                            i--;                        }                    }                }


"enemies.Add(new EnemySpawn(Content.Load("Graphics/Sprites/enemy"), new Vector2(1100, randY)));"

The part there it says Content.Load is where it comes up in red and displays "The name content does not exist in current context"

Help!

Regards,
Tim


#1Tubbly

Posted 27 December 2012 - 11:42 AM

I'm trying to spawn a new enemy in my game, I've been following a book to do this :
 


 public void LoadEnemies()
                {
                    int randY = random.Next(100,400);

                    if (spawnzz >= 1)
                    {
                        spawnzz = 0;

                        if (enemies.Count < 4)
                        {
                            enemies.Add(new EnemySpawn(Content.Load<Texture2D>("Graphics/Sprites/enemy"), new Vector2(1100, randY)));
                        }
                    }

                    for (int i = 0; i < enemies.Count; i++)
                    {
                        if (!enemies[i].isVisible)
                        {
                            enemies.RemoveAt(i);
                            i--;
                        }
                    }

                }

 

 

"enemies.Add(new EnemySpawn(Content.Load("Graphics/Sprites/enemy"), new Vector2(1100, randY)));"

The part there it says Content.Load is where it comes up in red and displays "The name content does not exist in current context"

Help!

Regards,
Tim


PARTNERS