Programa
{
/// <summary>
/// This is the main type for your game
/// </summary>
public class Game1 : Microsoft.Xna.Framework.Game
{
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
KeyboardState teclado;
Texture2D pacTexture;
Rectangle pacRect;
Texture2D fanTexture;Rectangle fanRect;
Texture2D fan2Texture;
Rectangle fan2Rect;
Texture2D fan3Texture;
Rectangle fan3Rect;
Texture2D winTexture;
Rectangle winRect;
Texture2D dieTexture;
Rectangle dieRect;
Texture2D esfTexture;
Rectangle esfRect;
bool derecha = false;
bool izquierda = false;bool abajo = false;
bool arriba = false;
bool derecha2 = false;
bool izquierda2 = false;
bool abajo2 = false;
bool arriba2 = false;
bool derecha3 = false;
bool izquierda3 = false;
bool abajo3 = false;
bool arriba3 = false;
bool visible = false;
bool visible2 = false;
bool visible3 =false;
bool visible4 = false;
bool inter = false;
bool muerte = false;
Random rand = new Random();
Color miColor;
public Game1()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
}
/// <summary>
/// Allows the game to perform anyinitialization it needs to before starting to run.
/// This is where it can query for any required services and load any non-graphic
/// related content. Calling base.Initialize will enumerate through any components
/// and initialize them as well.
/// </summary>
protected override void Initialize()
{
// TODO: Add yourinitialization logic here
base.Initialize();
}
/// <summary>
/// LoadContent will be called once per game and is the place to load
/// all of your content.
/// </summary>
protected override void LoadContent()
{
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch =new SpriteBatch(GraphicsDevice);
pacTexture = this.Content.Load<Texture2D>("pacman1");
pacRect = new Rectangle(750, 0, 50,50);
fanTexture = this.Content.Load<Texture2D>("fantasma");
fanRect = new Rectangle(1, 1, 50, 50);
esfTexture = this.Content.Load<Texture2D>("esfera");
esfRect = newRectangle(650, 450, 20, 20);
winTexture = this.Content.Load<Texture2D>("YouWin");
winRect = new Rectangle(0, 0, 800, 500);
dieTexture = this.Content.Load<Texture2D>("died");
dieRect = new Rectangle(0, 0, 800, 500);
// TODO: use this.Content to load your game content here
}
/// <summary>
///UnloadContent will be called once per game and is the place to unload
/// all content.
/// </summary>
protected override void UnloadContent()
{
// TODO: Unload any non ContentManager content here
}
/// <summary>
/// Allows the game to run logic such as updating the world,
/// checking forcollisions, gathering input, and playing audio.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Update(GameTime gameTime)
{
// Allows the game to exit
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
this.Exit();...
Regístrate para leer el documento completo.