Reputation: 322
I am having major trouble trying to move my game from XNA to a Xbox360, and I am not able to load it into the Xbox. I tried a blank slate. That worked but when while adding my own gam, then the below error occurs:
What is happening?
This is the initialize and load methods:
protected override void Initialize()
{
(Lots of Lists)
Blocks = new List<Block>();
(Lots of Char Maping)
char[,] Level1 = {{'.','.','.','.','.','.','.', ect...
Levels.Add(Level1);
Levels.Add(Level2);
Levels.Add(Level3);
Levels.Add(Level4);
Levels.Add(Level5);
Levels.Add(Level6);
Levels.Add(Level7);
currentLevel = 0;
Time = 0;
deathCount = 0;
offset = new Vector2(ScreenWidth / 2, ScreenHight - 300);
base.Initialize();
}
protected override void LoadContent()
{
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);
// TODO: use this.Content to load your game content here
font = Content.Load<SpriteFont>("Font");
font1 = Content.Load<SpriteFont>("Font");
Texture2D ballSprite = Content.Load<Texture2D>("Person");
rocketTexture = Content.Load<Texture2D>("Rocket");
rocketDown = Content.Load<Texture2D>("MissileDown");
rocketUp = Content.Load<Texture2D>("MissileUp");
rocketLeft = Content.Load<Texture2D>("MissileLeft");
rocketRight = Content.Load<Texture2D>("MissileRight");
Green = Content.Load<Texture2D>("Green Block");
player = new Player(ballSprite, Vector2.Zero, 6.0f, new Rectangle(0, 0, tileWidth, tileHeight));
movingPlatform = new MovingPlatform(ballSprite, Vector2.Zero, 3.0f, 1);
launcher = new Launcher(Green, Vector2.Zero, 0, Green);
launcher.Load();
camera = new Camera(GraphicsDevice.Viewport);
collision = new Collision_Manager();
collision.Initialize(this);
LoadLevel(currentLevel);
SoundManager.Initialize(Content);
Texture2D IdleingRight = Content.Load<Texture2D>("Animation/IdleRight");
IdleRight = Content.Load<Texture2D>("Animation/IdleRight");
IdleLeft = Content.Load<Texture2D>("Animation/IdleLeft");
InAirRight = Content.Load<Texture2D>("Animation/InAirRight");
InAirLeft = Content.Load<Texture2D>("Animation/InAirLeft");
animation.Add(new AnimationStrip("Idle", IdleingRight, 100, 1));
Texture2D RunningRight = Content.Load<Texture2D>("Animation/RunRight");
animation.Add(new AnimationStrip("RunRight", RunningRight, 55, 10));
Texture2D RunningLeft = Content.Load<Texture2D>("Animation/RunLeft");
animation.Add(new AnimationStrip("RunLeft", RunningLeft, 55, 10));
Texture2D JumpingLeft = Content.Load<Texture2D>("Animation/JumpLeft");
animation.Add(new AnimationStrip("JumpLeft", JumpingLeft, 25, 5));
Texture2D JumpingRight = Content.Load<Texture2D>("Animation/JumpRight");
animation.Add(new AnimationStrip("JumpRight", JumpingRight, 25, 5));
}
Upvotes: 0
Views: 84
Reputation: 322
It seems that in public Game1 you cant set the screen width or height and will cause an error on the xbox version.
so I simply removed the code and it works now.
public Game1()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
//this.graphics.PreferredBackBufferWidth = ScreenWidth;
// this.graphics.PreferredBackBufferHeight = ScreenHight;
//this.graphics.ApplyChanges();
}
Upvotes: 1