I am trying to great a lunar lander like Game using MonoGame with Xna, integrated with Visual Studios 2013 and my end goal is to run this a app on a Windows 8.1 phone. I am encountering some errors. Below is the code that is causing the most problems.
One of the errors I am having is in the Game1.cs file:
public class GameStart : Game
{
...
}
The error I am getting is
Error 1 Missing partial modifier on declaration of type 'GameName1.GameStart'; another partial declaration of this type exists C:\Users\Matthew\Documents\Visual Studio 2013\Projects\GameName1\GameName1\GamePage.xaml.cs
UPDATE
public GameStart()
{
_graphics = new GraphicsDeviceManager(this);
_graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft|DisplayOrientation.LandscapeRight;
_graphics.IsFullScreen = true;
Content.RootDirectory = "Content";
//if (_motion.IsDataValid) //gonna get an error
//{
_motion = new Motion();
//}
// Frame rate is 30 fps by default for Windows Phone.
TargetElapsedTime = TimeSpan.FromTicks(333333);
// Extend battery life under lock.
InactiveSleepTime = TimeSpan.FromSeconds(1);
_CurrentState = GameState.Active;
}
Type 'GameName1.GameStart' already defines a member called 'GameStart' with the same parameter types C:\Users\Matthew\Documents\Visual Studio 2013\Projects\GameName1\GameName1\Game1.cs
Here are both of the classes that this error message is referring to.
public GameStart()
{
InitializeComponent();
_game = XamlGame<Game>.Create("", this);
// Sample code to localize the ApplicationBar
//BuildLocalizedApplicationBar();
}
Update
I tired changing XamlGame.Create method to take string instead of "", and it gave me a different error, as a side note this code was auto generated.
public partial class GameStart : Game
{
private GameStart _game;
// Constructor
public GameStart()
{
InitializeComponent();
_game = XamlGame<Game>.Create(string , this);
// Sample code to localize the ApplicationBar
//BuildLocalizedApplicationBar();
}
} I was getting this error with " ":
Error 3 The best overloaded method match for 'MonoGame.Framework.WindowsPhone.XamlGame.Create(string, Microsoft.Phone.Controls.PhoneApplicationPage)' has some invalid arguments C:\Users\Matthew\Documents\Visual Studio 2013\Projects\GameName1\GameName1\GamePage.xaml.cs
But
now I am getting this error: Invalid expression term 'string'
.
stringmakes no sense, it is an alias for the type - the point is the variable or value you pass there has to be a string. - kaveman