Dificuldade com "Jogo" em XNA

Psycop

I fold therefore I AM
Boa Tarde

Como pequeno exercicio de programação em C# estou a fazer um pequeno jogo "pong" em XNA. Já tenho uma grande parte da estrutura feita, mas estou com um problema que não consigo resolver, que são os seguintes:

1 - Colisões com os bastões e seguinte recolocação da bola.
2 - verificar colisões com os lados direito e esquerdo assim como a recolocação da bola no lado contrário ao lado em que colidiu assim como a soma dos pontos.

O código que tenho é o seguinte:

Código:
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 Tetris
{
public class Game1 : Microsoft.Xna.Framework.Game
{
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;

// Imagens dos objetos do jogo

Texture2D texBastaoDireita;
Texture2D texBastaoEsquerda;
Texture2D texBola;

//variaveis para contagem de pontos dos jogadores
int pontosDir = 0;
int pontosEsq = 0;

SpriteFont Arial;

Vector2 posBola = new Vector2(5.0f, 5.0f);

KeyboardState keysboardState;

float speed = 5.0f;


// Vector que Guarda Informação da Posição da Bola.
Vector2 bolaSpeed = new Vector2 (150.0f, 150.0f);

//Posição do bastão

Vector2 posBastaoEsquerda = new Vector2(5,320);
Vector2 posBastaoDireita = new Vector2(780, 320);


public Game1()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
}

protected override void Initialize()
{


base.Initialize();
}

protected override void LoadContent()
{
spriteBatch = new SpriteBatch(GraphicsDevice);

// Carrega as texturas dos bastões e da bola
texBastaoEsquerda = Content.Load<Texture2D>"bastao");
texBastaoDireita = Content.Load<Texture2D>"bastao");
texBola = Content.Load<Texture2D>"bola");
Arial = Content.Load<SpriteFont>"Arial");
}

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

protected override void Update(GameTime gameTime)
{
// Mover a Bola em Relação à velocidade / tempo decorrido
posBola += bolaSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;

int MaxX = graphics.GraphicsDevice.Viewport.Width - texBola.Width;
int MinX = 0;
int MaxY = graphics.GraphicsDevice.Viewport.Height - texBola.Height;
int MinY = 0;


//Maximos para os bastões

int MaxbastaoY = graphics.GraphicsDevice.Viewport.Height - texBastaoDireita.Height;
int MinbastaoY = 0;

// Verificar a colisão dos bastões com as extremidades

//Bastão Direito
if (posBastaoDireita.Y > MaxbastaoY)
{
posBastaoDireita.Y *= -1;
posBastaoDireita.Y = MaxbastaoY;
}

else if (posBastaoDireita.Y < MinbastaoY)
{
posBastaoDireita.Y *= +1;
posBastaoDireita.Y = MinbastaoY;
}


//Bastão Esquerda
if (posBastaoEsquerda.Y > MaxbastaoY)
{
posBastaoEsquerda.Y *= -1;
posBastaoEsquerda.Y = MaxbastaoY;
}

else if (posBastaoEsquerda.Y < MinbastaoY)
{
posBastaoEsquerda.Y *= -1;
posBastaoEsquerda.Y = MinbastaoY;
}


// Verificar a colisão da bola com as extremidades
/*
if (posBola.X > MaxX)
{
bolaSpeed.X *= -1;
posBola.X = MaxbastaoY;
}

else if (posBola.X < MinX)
{
bolaSpeed.X *= -1;
posBola.X = MinX;
}
*/

if (posBola.Y > MaxY)
{
bolaSpeed.Y *= -1;
posBola.Y = MaxY;
}

else if (posBola.Y < MinY)
{
bolaSpeed.Y *= -1;
posBola.Y = MinY;
}


//Detectar Colisões Bola / Bastão
//Bastão Direito

if (posBola.X + texBola.Height >= posBastaoDireita.X)
{
bolaSpeed.X *= -1;
posBola.X = MaxbastaoY;
}

//Bastão Esquerdo

if (posBola.X - texBola.Height <= posBastaoEsquerda.X)
{
bolaSpeed.X *= -1;
posBola.X = MaxbastaoY;
}

// Se a bola saiu pela lateral, soma os pontos e reposiciona a bola
// saiu pela direita
if (posBola.X > MaxX)
{
pontosDir = pontosDir + 1;
posBola *= new Vector2(5.0f, 5.0f);
}

//saiu pela Esquerda
if (posBola.X < MinX)
{
pontosEsq = pontosEsq + 1;
posBola = new Vector2(775.0f, 5.0f);
}


// Declaramos o teclado
keysboardState = Keyboard.GetState();

//Bastao Esquerda
// Tecla para cima
if (keysboardState.IsKeyDown(Keys.Up))
{
posBastaoEsquerda.Y -= speed;
}
// Tecla para baixo
if (keysboardState.IsKeyDown(Keys.Down))
{
posBastaoEsquerda.Y += speed;
}

//Bastao Direita
// Tecla para esquerda
if (keysboardState.IsKeyDown(Keys.Left))
{
posBastaoDireita.Y -= speed;
}
// Tecla para direita
if (keysboardState.IsKeyDown(Keys.Right))
{
posBastaoDireita.Y += speed;
}

base.Update(gameTime);
}

protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);

// Pinta o fundo da tela de preto
graphics.GraphicsDevice.Clear(Color.Black);

// Desenha as texturas na tela
spriteBatch.Begin();

spriteBatch.Draw(texBola, posBola, Color.White);
spriteBatch.Draw(texBastaoEsquerda, posBastaoEsquerda, Color.White);
spriteBatch.Draw(texBastaoDireita, posBastaoDireita, Color.White);

spriteBatch.DrawString(Arial, pontosEsq.ToString() + ":" + pontosDir.ToString(), new Vector2(380, 20), Color.White);


spriteBatch.End();

base.Draw(gameTime);
}
}
}

Alguém me pode ajudar a entender o que estou a fazer mal e perceber como posso fazer correctamente? Neste momento queria perceber e colocar toda a mecânica do jogo a funcionar e só depois partir para a divisão do jogo e acções em classes específicas.

Cumps
 
Para testar colisões podes usar uma estrutura que o xna fornece chamada Rectangle.

Basicamente fazes algo do género:

Código:
Rectangle rBastaoEsquerda, rBastaoDireita, rBola;

rBastaoEsquerda = new Rectangle((int)posBastaoEsquerda.X, (int)posBastaoEsquerda.Y, texBastaoEsquerda.Width, texBastaoEsquerda.Height);
rBastaoDireita = new Rectangle((int)posBastaoDireita.X, (int)posBastaoDireita.Y, texBastaoDireita.Width, texBastaoDireita.Height);
rBola = new Rectangle((int)posBola.X, (int)posBola.Y, texBola.Width, texBola.Height);

para criar os rectângulos de colisão de cada uma das entidades e depois testas as colisões usando a função Intersects()

Código:
if(rBastaoEsquerda.Intersects(rBola))
{
    // inverter velocidade X
}

Depois fazes mais uns testes para verificar se a bola saiu da área de jogo (basicamente testar a posição X da bola é menor do 0 ou Viewport.Width) e quando isso acontecer colocas a bola onde quiseres. Não te esqueças de modificar a velocidade também.


Já agora no código tens coisas que não fazem muito sentido como:

Código:
posBastaoDireita.Y *= -1;
posBastaoDireita.Y = MaxbastaoY;

//...

[B]GraphicsDevice.Clear(Color.CornflowerBlue); // podes remover esta linha, já que logo a seguir pintas o fundo de preto :P[/B]


// Pinta o fundo da tela de preto
graphics.GraphicsDevice.Clear(Color.Black);


Cumps
 
Olá

Estou a tentar fazer um MENU de um jogo e estou com uma dificuldade que é retroceder para o MainMenu quando a tecla "ESC" for pressionada estando num qualquer outro Case do Switch (Easy, Medium ou Hard).

Para as actividades dos botões tenho a classe Button:

Código:
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;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace Pong_The_Game_1._01
{
class cButton
{
         Texture2D texture;
         Vector2 position;
         Rectangle rectangle;
         Color colour = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/%3Cspan%3Ehttp://%3C/span%3Ewww.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Color(255, 255, 255, 255);
         public Vector2 size;
         public cButton(Texture2D newTexture, GraphicsDevice graphics)
         {
                 texture = newTexture;
                 //screenW = 800, screenH = 600
                 //imdW = 100, imdH = 20
                 size = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/%3Cspan%3Ehttp://%3C/span%3Ewww.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(graphics.Viewport.Width / 5, graphics.Viewport.Height / 15);
         }
         bool down;
         public bool isClicked;
         public void update(MouseState mouse)
         {
                 rectangle = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/%3Cspan%3Ehttp://%3C/span%3Ewww.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Rectangle((int)position.X, (int)position.Y, (int)size.X, (int)size.Y);
                 Rectangle mouseRectangle = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/%3Cspan%3Ehttp://%3C/span%3Ewww.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Rectangle(mouse.X, mouse.Y, 1, 1);
                 if (mouseRectangle.Intersects(rectangle))
                 {
                         if (mouse.LeftButton == ButtonState.Pressed)
                         {
                                 isClicked = true;
                         }
                         else
                         {
                                 isClicked = false;
                         }
                 }
         }

         public void setPosition(Vector2 newPosition)
         {
                 position = newPosition;
         }
         public void Draw(SpriteBatch spriteBatch)
         {
                 spriteBatch.Draw(texture, rectangle, colour);
         }
}
}

Que depois uso no Game1:

Código:
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 Pong_The_Game_1._01
{
public class Game1 : Microsoft.Xna.Framework.Game
{
         GraphicsDeviceManager graphics;
         SpriteBatch spriteBatch;
         SpriteFont Arial;

         enum GameState
         {
                 MainMenu,
                 Easy,
                 Medium,
                 Hard
         }
         GameState CurrentGameState = GameState.MainMenu;


         int screenWidth = 800, screenHeight = 600;

         cButton btnPlay_Easy;
         cButton btnPlay_Medium;
         cButton btnPlay_Hard;
        
public Game1()
         {
                 graphics = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/%3Cspan%3Ehttp://%3C/span%3Ewww.google.com/search?q=new+msdn.microsoft.com"]new[/URL] GraphicsDeviceManager(this);
                 Content.RootDirectory = "Content";
         }

         protected override void Initialize()
         {

                 base.Initialize();
         }
         protected override void LoadContent()
         {
                 spriteBatch = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/%3Cspan%3Ehttp://%3C/span%3Ewww.google.com/search?q=new+msdn.microsoft.com"]new[/URL] SpriteBatch(GraphicsDevice);
                 graphics.PreferredBackBufferWidth = screenWidth;
                 graphics.PreferredBackBufferHeight = screenHeight;
                 graphics.ApplyChanges();
                 IsMouseVisible = true;
                 Arial = Content.Load<SpriteFont>("Arial");

                 btnPlay_Easy = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/%3Cspan%3Ehttp://%3C/span%3Ewww.google.com/search?q=new+msdn.microsoft.com"]new[/URL] cButton(Content.Load<Texture2D>("easy"), graphics.GraphicsDevice);
                 btnPlay_Easy.setPosition([URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/%3Cspan%3Ehttp://%3C/span%3Ewww.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(320, 300));
                 btnPlay_Medium = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/%3Cspan%3Ehttp://%3C/span%3Ewww.google.com/search?q=new+msdn.microsoft.com"]new[/URL] cButton(Content.Load<Texture2D>("medium"), graphics.GraphicsDevice);
                 btnPlay_Medium.setPosition([URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/%3Cspan%3Ehttp://%3C/span%3Ewww.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(320, 350));
                 btnPlay_Hard = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/%3Cspan%3Ehttp://%3C/span%3Ewww.google.com/search?q=new+msdn.microsoft.com"]new[/URL] cButton(Content.Load<Texture2D>("hard"), graphics.GraphicsDevice);
                 btnPlay_Hard.setPosition([URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/%3Cspan%3Ehttp://%3C/span%3Ewww.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(320, 400));
         }
         protected override void UnloadContent()
         {
                 // TODO: Unload any non ContentManager content here
         }
         protected override void Update(GameTime gameTime)
         {
                 MouseState mouse = Mouse.GetState();
                 switch (CurrentGameState)
                 {
                         case GameState.MainMenu:
                                 {
                                         if (btnPlay_Easy.isClicked == true)
                                         CurrentGameState = GameState.Easy;
                                         btnPlay_Easy.update(mouse);
                                         if (btnPlay_Medium.isClicked == true)
                                                 CurrentGameState = GameState.Medium;
                                         btnPlay_Medium.update(mouse);
                                         if (btnPlay_Hard.isClicked == true)
                                                 CurrentGameState = GameState.Hard;
                                         btnPlay_Hard.update(mouse);
                                         break;
                                 }
                         case GameState.Easy:
                                 {
                                         //Desenhar Nome do Jogo
                                         //spriteBatch.DrawString(Arial, "Pong_The_Game", new Vector2(260, 10), Color.White);



[color=#ff0000]///O Que pretendo é que depois de estar dentro do GameState.Easy seja possivel voltar ao GameState.MainMenu pressionando a tecla "ESC". Como poderei fazer isto?[/color]


                                         break;
                                 }
                         case GameState.Medium:
                                 {
                                         //Desenhar Nome do Jogo
                                         //spriteBatch.DrawString(Arial, "Pong_The_Game", new Vector2(260, 10), Color.White);
                                         break;
                                 }
                         case GameState.Hard:
                                 {
                                         //Desenhar Nome do Jogo
                                         //spriteBatch.DrawString(Arial, "Pong_The_Game", new Vector2(260, 10), Color.White);
                                         break;
                                 }
                 }
                         base.Update(gameTime);
         }



         protected override void Draw(GameTime gameTime)
         {
                 GraphicsDevice.Clear(Color.CornflowerBlue);
                 // Desenha as texturas na tela
                 spriteBatch.Begin();
                 switch (CurrentGameState)
                 {
                         case GameState.MainMenu:
                                 {
                                         spriteBatch.Draw(Content.Load<Texture2D>("background_pong_the_game"), [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/%3Cspan%3Ehttp://%3C/span%3Ewww.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Rectangle(0, 0, screenWidth, screenHeight), Color.White);
                                         btnPlay_Easy.Draw(spriteBatch);
                                         btnPlay_Medium.Draw(spriteBatch);
                                         btnPlay_Hard.Draw(spriteBatch);
                                         break;
                                 }
                         case GameState.Easy:
                                 {

                                         //Desenhar Nome do Jogo



[color=#FF0000]///O Que pretendo é que depois de estar dentro do GameState.Easy seja possivel voltar ao GameState.MainMenu pressionando a tecla "ESC". Como poderei fazer isto?[/color]


                                         break;
                                 }

                         case GameState.Medium:
                                 {

                                         //Desenhar Nome do Jogo
                                         graphics.GraphicsDevice.Clear(Color.Black);
                                         spriteBatch.DrawString(Arial, "Pong_The_Game_Medium", [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/%3Cspan%3Ehttp://%3C/span%3Ewww.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(220, 10), Color.White);

                                 }
                         case GameState.Hard:
                                 {

                                         //Desenhar Nome do Jogo
                                         graphics.GraphicsDevice.Clear(Color.Black);

                                         break;
                                 }
                 }

                 spriteBatch.End();
                 base.Draw(gameTime);
         }
}
}

Alguém me pode ajudar a resolver esta questão?

Cumps
 
Última edição:
Olá

Estou a tentar fazer um MENU de um jogo e estou com uma dificuldade em conjugar todos os switch e cases correctamente:

O Play tem como objectivo levar a um Sub_menu.

Ou seja:

MENU:

- Play:
- Easy
- Medium
- Hard

- Controls:
- Credits:

Código:
//Iclusão de Menu's e retrocesso para o MainMenu
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 Pong_The_Game_1._01
{
    public class Game1 : Microsoft.Xna.Framework.Game
    {
            GraphicsDeviceManager graphics;
            SpriteBatch spriteBatch;
            SpriteFont Arial;
            //Classe Bola
            Bola_Easy bola_Easy;
            Bola_Medium bola_Medium;
            Bola_Hard bola_Hard;
            //Classe Player
            Player player1;
            Player player2;
            //Textura a ser utilizada na classe Bola
            Texture2D imgBola;
            //Textura a ser utilizada na classe Player
            Texture2D imgPlayer;
           
            //Texture2D Imagns Background;
            Texture2D background;
            Texture2D controls_background;
            Texture2D credits_background;
            //Textura da "rede"
            Texture2D imgRede;
            //Array que irá receber cada "fatia" da imagem com seu respectivo número
            Rectangle[] pontos = null;
            //Pontos dos jogadores_Easy
            int pontosPlayer1_Easy;
            int pontosPlayer2_Easy;
            //Pontos dos jogadores_Medium
            int pontosPlayer1_Medium;
            int pontosPlayer2_Medium;
            //Pontos dos jogadores_Hard
            int pontosPlayer1_Hard;
            int pontosPlayer2_Hard;
            enum GameState
            {
                    MainMenu,
                    Play_Menu,
                    Play,
                    Controls,
                    Credits,
                    Easy,
                    Medium,
                    Hard
            }
            GameState CurrentGameState = GameState.MainMenu;
            int screenWidth = 800, screenHeight = 600;
            cButton btnPlay_Play;
            cButton btnPlay_Controls;
            cButton btnPlay_Credits;
            cButton btnPlay_Easy;
            cButton btnPlay_Medium;
            cButton btnPlay_Hard;

            public Game1()
            {
                    graphics = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] GraphicsDeviceManager(this);
                    Content.RootDirectory = "Content";
            }
            protected override void Initialize()
            {
                    bola_Easy = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Bola_Easy();
                    bola_Medium = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Bola_Medium();
                    bola_Hard = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Bola_Hard();
                    player1 = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Player();
                    player2 = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Player();
                    pontosPlayer1_Easy = 0;
                    pontosPlayer2_Easy = 0;
                    pontosPlayer1_Medium = 0;
                    pontosPlayer2_Medium = 0;
                    pontosPlayer1_Hard = 0;
                    pontosPlayer2_Hard = 0;
                    base.Initialize();
            }
            protected override void LoadContent()
            {
                    spriteBatch = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] SpriteBatch(GraphicsDevice);
                    graphics.PreferredBackBufferWidth = screenWidth;
                    graphics.PreferredBackBufferHeight = screenHeight;
                    graphics.ApplyChanges();
                    IsMouseVisible = true;
                    Arial = Content.Load<SpriteFont>("Arial");
                    //Carregando as imagens que serão utilizadas no jogo
                    imgBola = Content.Load<Texture2D>("bola");
                    imgPlayer = Content.Load<Texture2D>("player");
                    imgRede = Content.Load<Texture2D>("rede");
                    //Definições da Bola_Easy
                    //Aqui definimos as propriedades da bola como Tamanho, Posição inicial na tela
                    //velocidade e qual a textura a ser utilizada.
                    //Note tambem que utilizamos a classe Windows.ClientBound para posicionarmos
                    //nossa bola_Easy no centro da tela
                    bola_Easy.Tamanho = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(imgBola.Width, imgBola.Height);
                    bola_Easy.Posicao = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2((window.ClientBounds.Width / 2) - (bola_Easy.Tamanho.X / 2), (window.ClientBounds.Height / 2) - (bola_Easy.Tamanho.Y / 2));
                    //nossa bola_Medium no centro da tela
                    bola_Medium.Tamanho = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(imgBola.Width, imgBola.Height);
                    bola_Medium.Posicao = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2((window.ClientBounds.Width / 2) - (bola_Medium.Tamanho.X / 2), (window.ClientBounds.Height / 2) - (bola_Medium.Tamanho.Y / 2));
                    //nossa bola_Hard no centro da tela
                    bola_Hard.Tamanho = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(imgBola.Width, imgBola.Height);
                    bola_Hard.Posicao = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2((window.ClientBounds.Width / 2) - (bola_Hard.Tamanho.X / 2), (window.ClientBounds.Height / 2) - (bola_Hard.Tamanho.Y / 2));
                    //velocidade Bola_Easy
                    bola_Easy.Velocidade = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(5.0f, 5.0f);
                    //velocidade Bola_Medium
                    bola_Medium.Velocidade = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(8.0f, 8.0f);
                    //velocidade Bola_Hard
                    bola_Hard.Velocidade = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(10.0f, 10.0f);
                    bola_Easy.Textura = imgBola;
                    bola_Medium.Textura = imgBola;
                    bola_Hard.Textura = imgBola;
                    //Player 1
                    //Assim como a bola, definimos também os dados de cada player
                    player1.Tamanho = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(imgPlayer.Width, imgPlayer.Height);
                    player1.Posicao = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(10f, (window.ClientBounds.Height / 2 - imgPlayer.Height / 2));
                    player1.Velocidade = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(0, 5);
                    player1.Textura = imgPlayer;
                    //Player 2
                    player2.Tamanho = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(imgPlayer.Width, imgPlayer.Height);
                    player2.Posicao = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2((window.ClientBounds.Width - 10 - imgPlayer.Width), (window.ClientBounds.Height / 2 - imgPlayer.Height / 2));
                    player2.Velocidade = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(0, 5);
                    player2.Textura = imgPlayer;
                    pontos = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Rectangle[10];
                    //Carrega um array com a definição dos numeros
                    //Aqui realizamos o preenchimento de nosso array com seus
                    //respectivos valores para termos a posição certa de cada
                    //fatia dentro da imagem original
                    for (int i = 0; i < 10; i++)
                    {
                            pontos[i] = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Rectangle(i * 45, 0, 45, 75);
                    }

                    btnPlay_Play = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] cButton(Content.Load<Texture2D>("play"), graphics.GraphicsDevice);
                    btnPlay_Play.setPosition([URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(320, 300));
                    btnPlay_Controls = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] cButton(Content.Load<Texture2D>("controls"), graphics.GraphicsDevice);
                    btnPlay_Controls.setPosition([URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(320, 350));
                    btnPlay_Credits = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] cButton(Content.Load<Texture2D>("credits"), graphics.GraphicsDevice);
                    btnPlay_Credits.setPosition([URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(320, 400));
                    btnPlay_Easy = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] cButton(Content.Load<Texture2D>("easy"), graphics.GraphicsDevice);
                    btnPlay_Easy.setPosition([URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(320, 300));
                    btnPlay_Medium = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] cButton(Content.Load<Texture2D>("medium"), graphics.GraphicsDevice);
                    btnPlay_Medium.setPosition([URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(320, 350));
                    btnPlay_Hard = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] cButton(Content.Load<Texture2D>("hard"), graphics.GraphicsDevice);
                    btnPlay_Hard.setPosition([URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(320, 400));
                    background = Content.Load<Texture2D>("background_pong_the_game");
                    controls_background = Content.Load<Texture2D>("controls_background");
                    credits_background = Content.Load<Texture2D>("credits_background");
            }
            protected override void UnloadContent()
            {
                    // TODO: Unload any non ContentManager content here
            }
            protected override void Update(GameTime gameTime)
            {
                    MouseState mouse = Mouse.GetState();
                    KeyboardState keyboardstate = Keyboard.GetState();
                    switch (CurrentGameState)
                    {
                            case GameState.MainMenu:
                                    {
                                            if (btnPlay_Play.isClicked == true)
                                                    CurrentGameState = GameState.Play;
                                                    btnPlay_Play.update(mouse);
                                            if (btnPlay_Controls.isClicked == true)
                                                    CurrentGameState = GameState.Controls;
                                                    btnPlay_Controls.update(mouse);
                                            if (btnPlay_Credits.isClicked == true)
                                                    CurrentGameState = GameState.Credits;
                                                    btnPlay_Credits.update(mouse);
                                            break;
                                    }
                            case GameState.Play:
                                    {
                                            //Desenhar Nome do Jogo
                                            //spriteBatch.DrawString(Arial, "Pong_The_Game", new Vector2(260, 10), Color.White);

                                            //Menu dentro do Play
                                            switch (CurrentGameState)
                                            {
                                                    case GameState.Play:
                                                            {
                                                                    if (btnPlay_Easy.isClicked == true)
                                                                            CurrentGameState = GameState.Easy;
                                                                            btnPlay_Easy.update(mouse);
                                                                    if (btnPlay_Medium.isClicked == true)
                                                                            CurrentGameState = GameState.Medium;
                                                                            btnPlay_Medium.update(mouse);
                                                                    if (btnPlay_Hard.isClicked == true)
                                                                            CurrentGameState = GameState.Hard;
                                                                            btnPlay_Hard.update(mouse);

                                                                    break;
                                                            }
                                                    case GameState.Easy:
                                                            {
                                                                    //Desenhar Nome do Jogo
                                                                    //spriteBatch.DrawString(Arial, "Pong_The_Game", new Vector2(260, 10), Color.White);
                                                                    break;
                                                            }
                                                    case GameState.Medium:
                                                            {
                                                                    //Desenhar Nome do Jogo
                                                                    //spriteBatch.DrawString(Arial, "Pong_The_Game", new Vector2(260, 10), Color.White);

                                                                    break;
                                                            }
                                                    case GameState.Hard:
                                                            {
                                                                    //Desenhar Nome do Jogo
                                                                    //spriteBatch.DrawString(Arial, "Pong_The_Game", new Vector2(260, 10), Color.White);
                                                                   
                                                                    break;
                                                            }
                                            }
                                            break;
                                    }
                            case GameState.Controls:
                                    {
                                            //Desenhar Nome do Jogo
                                            //spriteBatch.DrawString(Arial, "Pong_The_Game", new Vector2(260, 10), Color.White);
                                            //Retroceder para o MainMenu
                                            if (keyboardstate.IsKeyDown(Keys.Escape))
                                            {
                                                    CurrentGameState = GameState.MainMenu;
                                                    break;
                                            }
                                            break;
                                    }
                            case GameState.Credits:
                                    {
                                            //Desenhar Nome do Jogo
                                            //spriteBatch.DrawString(Arial, "Pong_The_Game", new Vector2(260, 10), Color.White);
                                            //Retroceder para o MainMenu
                                            if (keyboardstate.IsKeyDown(Keys.Escape))
                                            {
                                                    CurrentGameState = GameState.MainMenu;
                                                    break;
                                            }
                                            break;
                                    }
                    }
                    //Bola_Easy
                    bola_Easy.checaColisao_Easy(player1.Retangulo, player2.Retangulo);
                    bola_Easy.mover_Easy(Window, ref pontosPlayer1_Easy, ref pontosPlayer2_Easy);
                    movePlayers();
                    if (pontosPlayer1_Easy > 9 || pontosPlayer2_Easy > 9)
                    {
                            pontosPlayer1_Easy = 0;
                            pontosPlayer2_Easy = 0;
                    }
                    //Bola_Medium
                    bola_Medium.checaColisao_Medium(player1.Retangulo, player2.Retangulo);
                    bola_Medium.mover_Medium(Window, ref pontosPlayer1_Medium, ref pontosPlayer2_Medium);
                    movePlayers();
                    if (pontosPlayer1_Medium > 9 || pontosPlayer2_Medium > 9)
                    {
                            pontosPlayer1_Medium = 0;
                            pontosPlayer2_Medium = 0;
                    }
                    //Bola_Hard
                    bola_Hard.checaColisao_Hard(player1.Retangulo, player2.Retangulo);
                    bola_Hard.mover_Hard(Window, ref pontosPlayer1_Hard, ref pontosPlayer2_Hard);
                    movePlayers();
                    if (pontosPlayer1_Hard > 9 || pontosPlayer2_Hard > 9)
                    {
                            pontosPlayer1_Hard = 0;
                            pontosPlayer2_Hard = 0;
                    }
                    base.Update(gameTime);
            }
            public void movePlayers()
            {
                    KeyboardState keys = Keyboard.GetState();
                    //Player 1
                    if (keys.IsKeyDown(Keys.A))
                    {
                            if (player1.Posicao.Y < 0)
                                    player1.Posicao = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(player1.Posicao.X, 0);
                            player1.Posicao -= player1.Velocidade;
                    }
                    if (keys.IsKeyDown(Keys.Z))
                    {
                            if (player1.Posicao.Y > window.ClientBounds.Height - player1.Textura.Height)
                                    player1.Posicao = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(player1.Posicao.X, (window.ClientBounds.Height - imgPlayer.Height));
                            player1.Posicao += player1.Velocidade;
                    }
                    //Player 2
                    if (keys.IsKeyDown(Keys.Up))
                    {
                            if (player2.Posicao.Y < 0)
                                    player2.Posicao = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(player2.Posicao.X, 0);
                            player2.Posicao -= player2.Velocidade;
                    }
                    if (keys.IsKeyDown(Keys.Down))
                    {
                            if (player2.Posicao.Y > window.ClientBounds.Height - player2.Textura.Height)
                                    player2.Posicao = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(player2.Posicao.X, (window.ClientBounds.Height - imgPlayer.Height));
                            player2.Posicao += player2.Velocidade;
                    }
                    //Voltar ao Menu Inicial
                    if (keys.IsKeyDown(Keys.O))
                    {
                    }
            }
            protected override void Draw(GameTime gameTime)
            {
                    // Desenha as texturas na tela
                    spriteBatch.Begin();
                    switch (CurrentGameState)
                    {
                            case GameState.MainMenu:
                                    {
                                            spriteBatch.Draw(background, [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Rectangle(0, 0, 800, 600), Color.White);
                                            btnPlay_Play.Draw(spriteBatch);
                                            btnPlay_Controls.Draw(spriteBatch);
                                            btnPlay_Credits.Draw(spriteBatch);
                                            break;
                                    }
                            case GameState.Play:
                                    {
                                            //graphics.GraphicsDevice.Clear(Color.White);
                                            spriteBatch.Draw(background, [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Rectangle(0, 0, 800, 600), Color.White);
                                            btnPlay_Easy.Draw(spriteBatch);
                                            btnPlay_Medium.Draw(spriteBatch);
                                            btnPlay_Hard.Draw(spriteBatch);
                                           
                                            switch (CurrentGameState)
                                            {
                                                    case GameState.Easy:
                                                    {
                                                            graphics.GraphicsDevice.Clear(Color.Black);
                                                            //Posicionamos nossa "rede" no centro da tela
                                                            spriteBatch.Draw(imgRede, [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2((window.ClientBounds.Width * .5f), 0), Color.White);
                                                            //Desenhar Nome do Jogo
                                                            spriteBatch.DrawString(Arial, "Pong_The_Game_Easy", [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(220, 10), Color.White);
                                                            //Desenhamos a pontuação do player 1 e do player 2
                                                            spriteBatch.DrawString(Arial, pontosPlayer1_Easy.ToString() + ":" + pontosPlayer2_Easy.ToString(), [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(380, 50), Color.White);
                                                            //Desenhamos nossa "bola" apesar de ser quadrada..rsrs
                                                            spriteBatch.Draw(bola_Easy.Textura, bola_Easy.Retangulo, Color.White);
                                                            //Desenhamos os Player, um de cada lado
                                                            spriteBatch.Draw(player1.Textura, player1.Retangulo, Color.White);
                                                            spriteBatch.Draw(player2.Textura, player2.Retangulo, Color.White);
                                                            break;
                                                    }
                                                    case GameState.Medium:
                                                    {
                                                            //Posicionamos nossa "rede" no centro da tela
                                                            spriteBatch.Draw(imgRede, [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2((window.ClientBounds.Width * .5f), 0), Color.White);
                                                            //Desenhar Nome do Jogo
                                                            graphics.GraphicsDevice.Clear(Color.Black);
                                                            spriteBatch.DrawString(Arial, "Pong_The_Game_Medium", [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(220, 10), Color.White);
                                                            //Desenhamos a pontuação do player 1 e do player 2
                                                            spriteBatch.DrawString(Arial, pontosPlayer1_Medium.ToString() + ":" + pontosPlayer2_Medium.ToString(), [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(380, 50), Color.White);
                                                            //Desenhamos nossa "bola" apesar de ser quadrada..rsrs
                                                            spriteBatch.Draw(bola_Medium.Textura, bola_Medium.Retangulo, Color.White);
                                                            //Desenhamos os Player, um de cada lado
                                                            spriteBatch.Draw(player1.Textura, player1.Retangulo, Color.White);
                                                            spriteBatch.Draw(player2.Textura, player2.Retangulo, Color.White);
                                                            break;
                                                    }
                                                    case GameState.Hard:
                                                    {
                                                            //Posicionamos nossa "rede" no centro da tela
                                                            spriteBatch.Draw(imgRede, [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2((window.ClientBounds.Width * .5f), 0), Color.White);
                                                            //Desenhar Nome do Jogo
                                                            graphics.GraphicsDevice.Clear(Color.Black);
                                                            spriteBatch.DrawString(Arial, "Pong_The_Game_Hard", [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(220, 10), Color.White);
                                                            //Desenhamos a pontuação do player 1 e do player 2
                                                            spriteBatch.DrawString(Arial, pontosPlayer1_Hard.ToString() + ":" + pontosPlayer2_Hard.ToString(), [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(380, 50), Color.White);
                                                            //Desenhamos nossa "bola" apesar de ser quadrada..rsrs
                                                            spriteBatch.Draw(bola_Hard.Textura, bola_Hard.Retangulo, Color.White);
                                                            //Desenhamos os Player, um de cada lado
                                                            spriteBatch.Draw(player1.Textura, player1.Retangulo, Color.White);
                                                            spriteBatch.Draw(player2.Textura, player2.Retangulo, Color.White);
                                                            break;
                                                    }

                                            }
                                            break;
                                          }
                                

                            case GameState.Controls:
                                    {
                                            spriteBatch.Draw(controls_background, [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Rectangle(0, 0, 800, 600), Color.White);
                                            break;
                                    }
                            case GameState.Credits:
                                    {
                                            spriteBatch.Draw(credits_background, [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Rectangle(0, 0, 800, 600), Color.White);
                                            break;
                                    }
                    }

                    spriteBatch.End();
                    base.Draw(gameTime);
            }
    }
}//Iclusão de Menu's e retrocesso para o MainMenu
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 Pong_The_Game_1._01
{
    public class Game1 : Microsoft.Xna.Framework.Game
    {
            GraphicsDeviceManager graphics;
            SpriteBatch spriteBatch;
            SpriteFont Arial;
            //Classe Bola
            Bola_Easy bola_Easy;
            Bola_Medium bola_Medium;
            Bola_Hard bola_Hard;
            //Classe Player
            Player player1;
            Player player2;
            //Textura a ser utilizada na classe Bola
            Texture2D imgBola;
            //Textura a ser utilizada na classe Player
            Texture2D imgPlayer;
           
            //Texture2D Imagns Background;
            Texture2D background;
            Texture2D controls_background;
            Texture2D credits_background;
            //Textura da "rede"
            Texture2D imgRede;
            //Array que irá receber cada "fatia" da imagem com seu respectivo número
            Rectangle[] pontos = null;
            //Pontos dos jogadores_Easy
            int pontosPlayer1_Easy;
            int pontosPlayer2_Easy;
            //Pontos dos jogadores_Medium
            int pontosPlayer1_Medium;
            int pontosPlayer2_Medium;
            //Pontos dos jogadores_Hard
            int pontosPlayer1_Hard;
            int pontosPlayer2_Hard;
            enum GameState
            {
                    MainMenu,
                    Play_Menu,
                    Play,
                    Controls,
                    Credits,
                    Easy,
                    Medium,
                    Hard
            }
            GameState CurrentGameState = GameState.MainMenu;
            int screenWidth = 800, screenHeight = 600;
            cButton btnPlay_Play;
            cButton btnPlay_Controls;
            cButton btnPlay_Credits;
            cButton btnPlay_Easy;
            cButton btnPlay_Medium;
            cButton btnPlay_Hard;

            public Game1()
            {
                    graphics = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] GraphicsDeviceManager(this);
                    Content.RootDirectory = "Content";
            }
            protected override void Initialize()
            {
                    bola_Easy = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Bola_Easy();
                    bola_Medium = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Bola_Medium();
                    bola_Hard = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Bola_Hard();
                    player1 = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Player();
                    player2 = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Player();
                    pontosPlayer1_Easy = 0;
                    pontosPlayer2_Easy = 0;
                    pontosPlayer1_Medium = 0;
                    pontosPlayer2_Medium = 0;
                    pontosPlayer1_Hard = 0;
                    pontosPlayer2_Hard = 0;
                    base.Initialize();
            }
            protected override void LoadContent()
            {
                    spriteBatch = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] SpriteBatch(GraphicsDevice);
                    graphics.PreferredBackBufferWidth = screenWidth;
                    graphics.PreferredBackBufferHeight = screenHeight;
                    graphics.ApplyChanges();
                    IsMouseVisible = true;
                    Arial = Content.Load<SpriteFont>("Arial");
                    //Carregando as imagens que serão utilizadas no jogo
                    imgBola = Content.Load<Texture2D>("bola");
                    imgPlayer = Content.Load<Texture2D>("player");
                    imgRede = Content.Load<Texture2D>("rede");
                    //Definições da Bola_Easy
                    //Aqui definimos as propriedades da bola como Tamanho, Posição inicial na tela
                    //velocidade e qual a textura a ser utilizada.
                    //Note tambem que utilizamos a classe Windows.ClientBound para posicionarmos
                    //nossa bola_Easy no centro da tela
                    bola_Easy.Tamanho = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(imgBola.Width, imgBola.Height);
                    bola_Easy.Posicao = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2((window.ClientBounds.Width / 2) - (bola_Easy.Tamanho.X / 2), (window.ClientBounds.Height / 2) - (bola_Easy.Tamanho.Y / 2));
                    //nossa bola_Medium no centro da tela
                    bola_Medium.Tamanho = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(imgBola.Width, imgBola.Height);
                    bola_Medium.Posicao = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2((window.ClientBounds.Width / 2) - (bola_Medium.Tamanho.X / 2), (window.ClientBounds.Height / 2) - (bola_Medium.Tamanho.Y / 2));
                    //nossa bola_Hard no centro da tela
                    bola_Hard.Tamanho = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(imgBola.Width, imgBola.Height);
                    bola_Hard.Posicao = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2((window.ClientBounds.Width / 2) - (bola_Hard.Tamanho.X / 2), (window.ClientBounds.Height / 2) - (bola_Hard.Tamanho.Y / 2));
                    //velocidade Bola_Easy
                    bola_Easy.Velocidade = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(5.0f, 5.0f);
                    //velocidade Bola_Medium
                    bola_Medium.Velocidade = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(8.0f, 8.0f);
                    //velocidade Bola_Hard
                    bola_Hard.Velocidade = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(10.0f, 10.0f);
                    bola_Easy.Textura = imgBola;
                    bola_Medium.Textura = imgBola;
                    bola_Hard.Textura = imgBola;
                    //Player 1
                    //Assim como a bola, definimos também os dados de cada player
                    player1.Tamanho = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(imgPlayer.Width, imgPlayer.Height);
                    player1.Posicao = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(10f, (window.ClientBounds.Height / 2 - imgPlayer.Height / 2));
                    player1.Velocidade = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(0, 5);
                    player1.Textura = imgPlayer;
                    //Player 2
                    player2.Tamanho = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(imgPlayer.Width, imgPlayer.Height);
                    player2.Posicao = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2((window.ClientBounds.Width - 10 - imgPlayer.Width), (window.ClientBounds.Height / 2 - imgPlayer.Height / 2));
                    player2.Velocidade = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(0, 5);
                    player2.Textura = imgPlayer;
                    pontos = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Rectangle[10];
                    //Carrega um array com a definição dos numeros
                    //Aqui realizamos o preenchimento de nosso array com seus
                    //respectivos valores para termos a posição certa de cada
                    //fatia dentro da imagem original
                    for (int i = 0; i < 10; i++)
                    {
                            pontos[i] = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Rectangle(i * 45, 0, 45, 75);
                    }

                    btnPlay_Play = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] cButton(Content.Load<Texture2D>("play"), graphics.GraphicsDevice);
                    btnPlay_Play.setPosition([URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(320, 300));
                    btnPlay_Controls = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] cButton(Content.Load<Texture2D>("controls"), graphics.GraphicsDevice);
                    btnPlay_Controls.setPosition([URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(320, 350));
                    btnPlay_Credits = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] cButton(Content.Load<Texture2D>("credits"), graphics.GraphicsDevice);
                    btnPlay_Credits.setPosition([URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(320, 400));
                    btnPlay_Easy = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] cButton(Content.Load<Texture2D>("easy"), graphics.GraphicsDevice);
                    btnPlay_Easy.setPosition([URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(320, 300));
                    btnPlay_Medium = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] cButton(Content.Load<Texture2D>("medium"), graphics.GraphicsDevice);
                    btnPlay_Medium.setPosition([URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(320, 350));
                    btnPlay_Hard = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] cButton(Content.Load<Texture2D>("hard"), graphics.GraphicsDevice);
                    btnPlay_Hard.setPosition([URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(320, 400));
                    background = Content.Load<Texture2D>("background_pong_the_game");
                    controls_background = Content.Load<Texture2D>("controls_background");
                    credits_background = Content.Load<Texture2D>("credits_background");
            }
            protected override void UnloadContent()
            {
                    // TODO: Unload any non ContentManager content here
            }
            protected override void Update(GameTime gameTime)
            {
                    MouseState mouse = Mouse.GetState();
                    KeyboardState keyboardstate = Keyboard.GetState();
                    switch (CurrentGameState)
                    {
                            case GameState.MainMenu:
                                    {
                                            if (btnPlay_Play.isClicked == true)
                                                    CurrentGameState = GameState.Play;
                                                    btnPlay_Play.update(mouse);
                                            if (btnPlay_Controls.isClicked == true)
                                                    CurrentGameState = GameState.Controls;
                                                    btnPlay_Controls.update(mouse);
                                            if (btnPlay_Credits.isClicked == true)
                                                    CurrentGameState = GameState.Credits;
                                                    btnPlay_Credits.update(mouse);
                                            break;
                                    }
                            case GameState.Play:
                                    {
                                            //Desenhar Nome do Jogo
                                            //spriteBatch.DrawString(Arial, "Pong_The_Game", new Vector2(260, 10), Color.White);

                                            //Menu dentro do Play
                                            switch (CurrentGameState)
                                            {
                                                    case GameState.Play:
                                                            {
                                                                    if (btnPlay_Easy.isClicked == true)
                                                                            CurrentGameState = GameState.Easy;
                                                                            btnPlay_Easy.update(mouse);
                                                                    if (btnPlay_Medium.isClicked == true)
                                                                            CurrentGameState = GameState.Medium;
                                                                            btnPlay_Medium.update(mouse);
                                                                    if (btnPlay_Hard.isClicked == true)
                                                                            CurrentGameState = GameState.Hard;
                                                                            btnPlay_Hard.update(mouse);

                                                                    break;
                                                            }
                                                    case GameState.Easy:
                                                            {
                                                                    //Desenhar Nome do Jogo
                                                                    //spriteBatch.DrawString(Arial, "Pong_The_Game", new Vector2(260, 10), Color.White);
                                                                    break;
                                                            }
                                                    case GameState.Medium:
                                                            {
                                                                    //Desenhar Nome do Jogo
                                                                    //spriteBatch.DrawString(Arial, "Pong_The_Game", new Vector2(260, 10), Color.White);

                                                                    break;
                                                            }
                                                    case GameState.Hard:
                                                            {
                                                                    //Desenhar Nome do Jogo
                                                                    //spriteBatch.DrawString(Arial, "Pong_The_Game", new Vector2(260, 10), Color.White);
                                                                   
                                                                    break;
                                                            }
                                            }
                                            break;
                                    }
                            case GameState.Controls:
                                    {
                                            //Desenhar Nome do Jogo
                                            //spriteBatch.DrawString(Arial, "Pong_The_Game", new Vector2(260, 10), Color.White);
                                            //Retroceder para o MainMenu
                                            if (keyboardstate.IsKeyDown(Keys.Escape))
                                            {
                                                    CurrentGameState = GameState.MainMenu;
                                                    break;
                                            }
                                            break;
                                    }
                            case GameState.Credits:
                                    {
                                            //Desenhar Nome do Jogo
                                            //spriteBatch.DrawString(Arial, "Pong_The_Game", new Vector2(260, 10), Color.White);
                                            //Retroceder para o MainMenu
                                            if (keyboardstate.IsKeyDown(Keys.Escape))
                                            {
                                                    CurrentGameState = GameState.MainMenu;
                                                    break;
                                            }
                                            break;
                                    }
                    }
                    //Bola_Easy
                    bola_Easy.checaColisao_Easy(player1.Retangulo, player2.Retangulo);
                    bola_Easy.mover_Easy(Window, ref pontosPlayer1_Easy, ref pontosPlayer2_Easy);
                    movePlayers();
                    if (pontosPlayer1_Easy > 9 || pontosPlayer2_Easy > 9)
                    {
                            pontosPlayer1_Easy = 0;
                            pontosPlayer2_Easy = 0;
                    }
                    //Bola_Medium
                    bola_Medium.checaColisao_Medium(player1.Retangulo, player2.Retangulo);
                    bola_Medium.mover_Medium(Window, ref pontosPlayer1_Medium, ref pontosPlayer2_Medium);
                    movePlayers();
                    if (pontosPlayer1_Medium > 9 || pontosPlayer2_Medium > 9)
                    {
                            pontosPlayer1_Medium = 0;
                            pontosPlayer2_Medium = 0;
                    }
                    //Bola_Hard
                    bola_Hard.checaColisao_Hard(player1.Retangulo, player2.Retangulo);
                    bola_Hard.mover_Hard(Window, ref pontosPlayer1_Hard, ref pontosPlayer2_Hard);
                    movePlayers();
                    if (pontosPlayer1_Hard > 9 || pontosPlayer2_Hard > 9)
                    {
                            pontosPlayer1_Hard = 0;
                            pontosPlayer2_Hard = 0;
                    }
                    base.Update(gameTime);
            }
            public void movePlayers()
            {
                    KeyboardState keys = Keyboard.GetState();
                    //Player 1
                    if (keys.IsKeyDown(Keys.A))
                    {
                            if (player1.Posicao.Y < 0)
                                    player1.Posicao = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(player1.Posicao.X, 0);
                            player1.Posicao -= player1.Velocidade;
                    }
                    if (keys.IsKeyDown(Keys.Z))
                    {
                            if (player1.Posicao.Y > window.ClientBounds.Height - player1.Textura.Height)
                                    player1.Posicao = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(player1.Posicao.X, (window.ClientBounds.Height - imgPlayer.Height));
                            player1.Posicao += player1.Velocidade;
                    }
                    //Player 2
                    if (keys.IsKeyDown(Keys.Up))
                    {
                            if (player2.Posicao.Y < 0)
                                    player2.Posicao = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(player2.Posicao.X, 0);
                            player2.Posicao -= player2.Velocidade;
                    }
                    if (keys.IsKeyDown(Keys.Down))
                    {
                            if (player2.Posicao.Y > window.ClientBounds.Height - player2.Textura.Height)
                                    player2.Posicao = [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(player2.Posicao.X, (window.ClientBounds.Height - imgPlayer.Height));
                            player2.Posicao += player2.Velocidade;
                    }
                    //Voltar ao Menu Inicial
                    if (keys.IsKeyDown(Keys.O))
                    {
                    }
            }
            protected override void Draw(GameTime gameTime)
            {
                    // Desenha as texturas na tela
                    spriteBatch.Begin();
                    switch (CurrentGameState)
                    {
                            case GameState.MainMenu:
                                    {
                                            spriteBatch.Draw(background, [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Rectangle(0, 0, 800, 600), Color.White);
                                            btnPlay_Play.Draw(spriteBatch);
                                            btnPlay_Controls.Draw(spriteBatch);
                                            btnPlay_Credits.Draw(spriteBatch);
                                            break;
                                    }
                            case GameState.Play:
                                    {
                                            //graphics.GraphicsDevice.Clear(Color.White);
                                            spriteBatch.Draw(background, [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Rectangle(0, 0, 800, 600), Color.White);
                                            btnPlay_Easy.Draw(spriteBatch);
                                            btnPlay_Medium.Draw(spriteBatch);
                                            btnPlay_Hard.Draw(spriteBatch);
                                           
                                            switch (CurrentGameState)
                                            {
                                                    case GameState.Easy:
                                                    {
                                                            graphics.GraphicsDevice.Clear(Color.Black);
                                                            //Posicionamos nossa "rede" no centro da tela
                                                            spriteBatch.Draw(imgRede, [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2((window.ClientBounds.Width * .5f), 0), Color.White);
                                                            //Desenhar Nome do Jogo
                                                            spriteBatch.DrawString(Arial, "Pong_The_Game_Easy", [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(220, 10), Color.White);
                                                            //Desenhamos a pontuação do player 1 e do player 2
                                                            spriteBatch.DrawString(Arial, pontosPlayer1_Easy.ToString() + ":" + pontosPlayer2_Easy.ToString(), [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(380, 50), Color.White);
                                                            //Desenhamos nossa "bola" apesar de ser quadrada..rsrs
                                                            spriteBatch.Draw(bola_Easy.Textura, bola_Easy.Retangulo, Color.White);
                                                            //Desenhamos os Player, um de cada lado
                                                            spriteBatch.Draw(player1.Textura, player1.Retangulo, Color.White);
                                                            spriteBatch.Draw(player2.Textura, player2.Retangulo, Color.White);
                                                            break;
                                                    }
                                                    case GameState.Medium:
                                                    {
                                                            //Posicionamos nossa "rede" no centro da tela
                                                            spriteBatch.Draw(imgRede, [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2((window.ClientBounds.Width * .5f), 0), Color.White);
                                                            //Desenhar Nome do Jogo
                                                            graphics.GraphicsDevice.Clear(Color.Black);
                                                            spriteBatch.DrawString(Arial, "Pong_The_Game_Medium", [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(220, 10), Color.White);
                                                            //Desenhamos a pontuação do player 1 e do player 2
                                                            spriteBatch.DrawString(Arial, pontosPlayer1_Medium.ToString() + ":" + pontosPlayer2_Medium.ToString(), [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(380, 50), Color.White);
                                                            //Desenhamos nossa "bola" apesar de ser quadrada..rsrs
                                                            spriteBatch.Draw(bola_Medium.Textura, bola_Medium.Retangulo, Color.White);
                                                            //Desenhamos os Player, um de cada lado
                                                            spriteBatch.Draw(player1.Textura, player1.Retangulo, Color.White);
                                                            spriteBatch.Draw(player2.Textura, player2.Retangulo, Color.White);
                                                            break;
                                                    }
                                                    case GameState.Hard:
                                                    {
                                                            //Posicionamos nossa "rede" no centro da tela
                                                            spriteBatch.Draw(imgRede, [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2((window.ClientBounds.Width * .5f), 0), Color.White);
                                                            //Desenhar Nome do Jogo
                                                            graphics.GraphicsDevice.Clear(Color.Black);
                                                            spriteBatch.DrawString(Arial, "Pong_The_Game_Hard", [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(220, 10), Color.White);
                                                            //Desenhamos a pontuação do player 1 e do player 2
                                                            spriteBatch.DrawString(Arial, pontosPlayer1_Hard.ToString() + ":" + pontosPlayer2_Hard.ToString(), [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Vector2(380, 50), Color.White);
                                                            //Desenhamos nossa "bola" apesar de ser quadrada..rsrs
                                                            spriteBatch.Draw(bola_Hard.Textura, bola_Hard.Retangulo, Color.White);
                                                            //Desenhamos os Player, um de cada lado
                                                            spriteBatch.Draw(player1.Textura, player1.Retangulo, Color.White);
                                                            spriteBatch.Draw(player2.Textura, player2.Retangulo, Color.White);
                                                            break;
                                                    }

                                            }
                                            break;
                                          }
                                

                            case GameState.Controls:
                                    {
                                            spriteBatch.Draw(controls_background, [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Rectangle(0, 0, 800, 600), Color.White);
                                            break;
                                    }
                            case GameState.Credits:
                                    {
                                            spriteBatch.Draw(credits_background, [URL="http://www.portugal-a-programar.pt/topic/57956-dificuldade-com-jogo-em-xna/<span>http://</span>www.google.com/search?q=new+msdn.microsoft.com"]new[/URL] Rectangle(0, 0, 800, 600), Color.White);
                                            break;
                                    }
                    }

                    spriteBatch.End();
                    base.Draw(gameTime);
            }
    }
}

O que acontece e que denro do sub_Menu Play não estão a aparecer o easy, medium e hard. Alguém me sabe dizer onde estou a errar?
 
Continuo com problemas no desenho do sub_menu dentro do Play, sitio onde deveriam ser desenhados os botões dos níveis de dificuldade, e na verdade são desenhados, mas apenas por instantes sendo substituidos logo a seguir pela cor default.

Aqui fica apenas a estutura dos Menus:

Código:
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 Pong_The_Game_1._03
{


    public class Game1 : Microsoft.Xna.Framework.Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;
        //Variavel para upload da fonte Arial
        SpriteFont Arial;
        //Texture2D Imagens Background;
        Texture2D background;
        Texture2D controls_background;
        Texture2D credits_background;
        //Enumeração dos estados do Jogo para o MENU / Botões
        enum GameState
        {
            MainMenu,
            Play,
            Play_Menu,
            Controls,
            Credits,
            Easy,
            Medium,
            Hard,
            Back
        }
        //Estado Actual do GameState
        GameState CurrentGameState = GameState.MainMenu;
        //Estado do GameState no Menu Play
        GameState Current_Play_GameState = GameState.Play_Menu;
        //Definição do tamanho do Ecrã
        int screenWidth = 800, screenHeight = 600;
        //Variáveis de cada Botão
        cButton btnPlay_Play;
        cButton btnPlay_Controls;
        cButton btnPlay_Credits;
        cButton btnPlay_Easy;
        cButton btnPlay_Medium;
        cButton btnPlay_Hard;
        cButton btnPlay_Back;
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
        }


        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            base.Initialize();
        }


        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            //Definição do tamanho do Ecrã
            graphics.PreferredBackBufferWidth = screenWidth;
            graphics.PreferredBackBufferHeight = screenHeight;
            graphics.ApplyChanges();
            IsMouseVisible = true;
            //Upload da Fonte Arial
            Arial = Content.Load<SpriteFont>("Arial");
            //Upload dos Botões:
            btnPlay_Play = new cButton(Content.Load<Texture2D>("play"), graphics.GraphicsDevice);
            btnPlay_Play.setPosition(new Vector2(320, 300));
            btnPlay_Controls = new cButton(Content.Load<Texture2D>("controls"), graphics.GraphicsDevice);
            btnPlay_Controls.setPosition(new Vector2(320, 350));
            btnPlay_Credits = new cButton(Content.Load<Texture2D>("credits"), graphics.GraphicsDevice);
            btnPlay_Credits.setPosition(new Vector2(320, 400));
            btnPlay_Easy = new cButton(Content.Load<Texture2D>("easy"), graphics.GraphicsDevice);
            btnPlay_Easy.setPosition(new Vector2(320, 300));
            btnPlay_Medium = new cButton(Content.Load<Texture2D>("medium"), graphics.GraphicsDevice);
            btnPlay_Medium.setPosition(new Vector2(320, 350));
            btnPlay_Hard = new cButton(Content.Load<Texture2D>("hard"), graphics.GraphicsDevice);
            btnPlay_Hard.setPosition(new Vector2(320, 400));
            btnPlay_Back = new cButton(Content.Load<Texture2D>("back"), graphics.GraphicsDevice);
            btnPlay_Back.setPosition(new Vector2(20, 550));
            //Upload das Img Background
            background = Content.Load<Texture2D>("background_pong_the_game");
            controls_background = Content.Load<Texture2D>("controls_background");
            credits_background = Content.Load<Texture2D>("credits_background");
        }


        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)
                this.Exit();
            //Definição do GameState do Rato
            MouseState mouse = Mouse.GetState();
            //Menu Principal
            switch (CurrentGameState)
            {
                //Definição do Menu Principal
                case GameState.MainMenu:
                    {
                        if (btnPlay_Play.isClicked == true)
                            CurrentGameState = GameState.Play;
                        btnPlay_Play.update(mouse);
                        if (btnPlay_Controls.isClicked == true)
                            CurrentGameState = GameState.Controls;
                        btnPlay_Controls.update(mouse);
                        if (btnPlay_Credits.isClicked == true)
                            CurrentGameState = GameState.Credits;
                        btnPlay_Credits.update(mouse);
                        break;
                    }


                //Metodo do Play
                case GameState.Play:
                    {
                        //Play_Menu
                        switch (Current_Play_GameState)
                        {
                            //Definição do Play_Menu
                            case GameState.Play_Menu:
                                {
                                    if (btnPlay_Easy.isClicked == true)
                                        Current_Play_GameState = GameState.Easy;
                                        btnPlay_Easy.update(mouse);
                                    if (btnPlay_Medium.isClicked == true)
                                        Current_Play_GameState = GameState.Medium;
                                        btnPlay_Medium.update(mouse);
                                    if (btnPlay_Hard.isClicked == true)
                                        Current_Play_GameState = GameState.Hard;
                                        btnPlay_Hard.update(mouse);
                                    break;
                                }
                            case GameState.Easy:
                                {
                                    break;
                                }
                            case GameState.Medium:
                                {
                                    break;
                                }
                            case GameState.Hard:
                                {
                                    break;
                                }
                        }
                        break;
                    }
            
                //Metodo do Controls
                case GameState.Controls:
                    {
                        break;
                    }
                //Metodo do Credits
                case GameState.Credits:
                    {
                        break;
                    }
                //Metodo Default
                default:
                    {
                        break;
                    }
            }


            base.Update(gameTime);
        }


        protected override void Draw(GameTime gameTime)
        {
            // Desenha as texturas na tela
            spriteBatch.Begin();


            //Desenha o Menu Principal no Ecrã
            //Menu Principal
            switch (CurrentGameState)
            {
                //Definição do Menu Principal
                case GameState.MainMenu:
                    {
                        spriteBatch.Draw(background, new Rectangle(0, 0, 800, 600), Color.White);
                        btnPlay_Play.Draw(spriteBatch);
                        btnPlay_Controls.Draw(spriteBatch);
                        btnPlay_Credits.Draw(spriteBatch);
                        break;
                    }
                //Metodo do Play
                case GameState.Play:
                    {
                        //Play_Menu
                        switch (Current_Play_GameState)
                        {
                            //Definição do Play_Menu
                            case GameState.Play_Menu:
                                {
                                    spriteBatch.Draw(background, new Rectangle(0, 0, 800, 600), Color.White);
                                    btnPlay_Easy.Draw(spriteBatch);
                                    btnPlay_Medium.Draw(spriteBatch);
                                    btnPlay_Hard.Draw(spriteBatch);
                                    break;
                                }
                            case GameState.Easy:
                                {
                                    break;
                                }
                            case GameState.Medium:
                                {
                                    break;
                                }
                            case GameState.Hard:
                                {
                                    break;
                                }
                        }
                        break;
                    }
                //Metodo do Controls
                case GameState.Controls:
                    {
                        break;
                    }
                //Metodo do Credits
                case GameState.Credits:
                    {
                        break;
                    }
                //Metodo Default
                default:
                    {
                        break;
                    }
            }
            spriteBatch.End();
            base.Draw(gameTime);
        }
    }
}

Alguém me consegue ajudar a detectar e corrigir o erro?

Cumps
 
Back
Topo