KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want to start by saying I did search first, and found a lot of similar issues on various other things, but not this problem exactly. I have this code: namespace New_Game.GameClasses { /// <summary> /// This is a game component that implements IUpdateable. /// </summary> public class Error : Microsoft.Xna.Framework.GameComponent { bool gameOver = false; List<Enemy> enemies = new List<Enemy>(); public bool gameOver { get { return gameOver; } set { gameOver = value; } } public override void Update(GameTime gameTime, Vector2 target) { // TODO: Add your update code here Rectangle playerRect = new Rectangle((int)target.X, (int)target.Y, 64, 64); foreach (Enemy e in enemies) { e.Target = target; e.Update(gameTime); Rectangle enemyRect = new Rectangle((int)e.Position.X + 7, (int)e.Position.Y + 7, 32 - 7, 32 - 7); if (playerRect.Intersects(enemyRect)) { gameOver = true; } } } } } My problem comes in an error saying this: Ambiguity between 'New_Game.GameClasses.Error.gameOver' and 'New_Game.GameClasses.Error.gameOver' If I remove the get/set method, I run into a different error when I try and access gameOver from my Game1.cs. If I change it to the following I get the same error: public bool gameOver { get; set; } My question, is how do I resolve the ambiguity errors?
Tags (comma-separated)
Save Edits
Cancel