if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Escape)) this.Exit(); if (Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Left)) ballPosition.X -= ballSpeed; if (Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Right)) ballPosition.X += ballSpeed; if (Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Down)) ballPosition.Y += ballSpeed; if (Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Up)) ballPosition.Y -= ballSpeed; if (ballPosition.X >= width) ballPosition.X = width; if (ballPosition.X <= 0) ballPosition.X = 0; if (ballPosition.Y >= height) ballPosition.Y = height; if (ballPosition.Y <= 0) ballPosition.Y = 0; base.Update(gameTime);
width = graphics.GraphicsDevice.Viewport.Width; height = graphics.GraphicsDevice.Viewport.Height; ballPosition.X = width / 2; ballPosition.Y = height / 2;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)