-3

So, I've created a list with 2 objects in. I want to make sure they both update.

public static void Update(GameTime gameTime)
{
    Player.Update(gameTime);
    Seagull.Update(gameTime);
    foreach (Seagull seagull in seagulls)
    {
        seagull.Update(gameTime);//Here is where the error is. 
    }
}

This is the error observed Error

Help would be greatly appreciated.

Adam
  • 1
  • 1
  • 2
    What is the error exactly? – juharr Nov 24 '15 at 15:27
  • I've updated my Question with a screen shot of the error. – Adam Nov 24 '15 at 15:32
  • 2
    Does [this question](http://stackoverflow.com/questions/1100009/member-method-cannot-be-accessed-with-an-instance-reference) help? It was the first result in Google, and suggests that your `Seagull.Update()` method is static. Perhaps you didn't mean for that method to be static? – Jacob Nov 24 '15 at 15:34
  • 4
    It's preferable to include the error text in the question rather than linking to a screen shot. – juharr Nov 24 '15 at 15:48

1 Answers1

0

the error tells us that seagull.Update is a static method, which means it can't be called for each seagull, only for 'seagulls' as a whole. I suspect you don't want this, and will need to stop it being a static method (by removing the static keyword).

For more information on static methods: What's a "static method" in C#? https://msdn.microsoft.com/en-gb/library/98f28cdx.aspx

Community
  • 1
  • 1
simonalexander2005
  • 4,338
  • 4
  • 48
  • 92