I'm following a tutorial from XNA GPA, but in my project, none of the sprites are loading. I've followed all of the instructions exactly, and the code works as expected when I copy it from my project into the example project that he provides.

Here's my Game.cs

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace Tutorial

    public class Game : Microsoft.Xna.Framework.Game
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;
        Paddle paddle;
        Rectangle screenRectangle;

        public Game()
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            screenRectangle = new Rectangle(0, 0, graphics.PreferredBackBufferWidth,

        protected override void Initialize()
            // TODO: Add your initialization logic here


        protected override void LoadContent()
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            Texture2D tempTexture = Content.Load<Texture2D>("paddle");
            paddle = new Paddle(tempTexture, screenRectangle);
            // TODO: use this.Content to load your game content here

        protected override void UnloadContent()
            // TODO: Unload any non ContentManager content here

        protected override void Update(GameTime gameTime)
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)

            // TODO: Add your update logic here



        protected override void Draw(GameTime gameTime)

            // TODO: Add your drawing code here



Any help would be greatly appreciated, thank you.

  • \$\begingroup\$ So it runs and nothing happens (no errors)? You get a CornflowerBlue screen? \$\endgroup\$
    – Felsir
    Jul 26, 2015 at 14:55
  • \$\begingroup\$ Yes, that's correct. \$\endgroup\$ Jul 26, 2015 at 15:08
  • \$\begingroup\$ Set the paddle position to be in the middle of the screen \$\endgroup\$
    – dimitris93
    Jul 26, 2015 at 15:31
  • \$\begingroup\$ Yeah, modify the Paddle.Draw function to draw a texture at coordinates you know are inside the viewport. \$\endgroup\$
    – Felsir
    Jul 26, 2015 at 18:27
  • \$\begingroup\$ Here's my SetInStartPosition method private void SetInStartPosition() { position.X = (screenBounds.Width - texture.Width) / 2; position.Y = screenBounds.Width - texture.Width - 5; } and my Draw() method public void Draw(SpriteBatch spriteBatch) { spriteBatch.Draw(texture, position, Color.White); } SetInStartPosition() is called in the constructor for paddle so surely this should work? \$\endgroup\$ Jul 26, 2015 at 18:41

1 Answer 1


A possible problem is in your SetInStartPosition(). For setting the Y position it should be position.Y = screenBounds.Height - texture.Height... not screenBounds.Width - texture.Width...


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .