/p>
/// lt;/summary gt; override void Initialize ()
{= new Menu (); newGame=new MenuItem ( Start Game ); resumeGame=new MenuItem ( Resume Game ); exitGame=new MenuItem ( Exit );
. Active=false;
. Click +=new EventHandler (newGame_Click) ;. Click +=new EventHandler (resumeGame_Click) ;. Click +=new EventHandler (exitGame_Click);
. Items.Add (newGame) ;. Items.Add (resumeGame) ;. Items.Add (exitGame);
. Initialize ();
}
void exitGame_Click (object sender, EventArgs e)
{. Exit ();
} void resumeGame_Click (object sender, EventArgs e)
{= GameState.Game;
}
void newGame_Click (object sender, EventArgs e)
{. Items [1] .Active=true;=GameState.Game;=new Actor ( Hero raquo ;, Content, 4, 2, 3, gamePhysics);
(int i=1; i lt; 5; i ++)
{[i]=new Field (gamePhysics, Hero); [i] .LoadField (Content, level + i.ToString ());
}
}
/// lt; summary gt;
/// LoadContent will be called once per game and is the place to load
/// all of your content.
/// lt;/summary gt; override void LoadContent ()
{
//Create a new SpriteBatch, which can be used to draw textures.=new SpriteBatch (GraphicsDevice);
=Content.Load lt; Texture2D gt; (@ Textures/hp );=Content.Load lt; Texture2D gt; (@ Textures/hp1 );
//Межі ігрового поля
_ viewPortRectangle=new Rectangle (0, 0, .GraphicsDevice.Viewport.Width, .GraphicsDevice.Viewport.Height);
. LoadContent (Content);
}
/// lt; summary gt;
/// UnloadContent will be called once per game and is the place to unload
/// all content.
/// lt;/summary gt; override void UnloadContent ()
{
}
/// lt; summary gt;
/// Allows the game to run logic such as updating the world,
/// checking for collisions, gathering input, and playing audio.
/// lt;/summary gt;
/// lt; param name= gameTime gt; Provides a snapshot of timing values. lt;/param gt; override void Update (GameTime gameTime)
{(gameState == GameState.Game) (gameTime); menu.Update () ;. Update (gameTime);
} void UpdateGameLogic (GameTime gameTime)
{
(level [currentLevel] .fieldEmpty () == true)
{. Position.X=MathHelper.Clamp (Hero.Position.X, -Hero.Width,
_ viewPortRectangle.Width + Hero.Width) ;. Position.Y=MathHelper.Clamp (Hero.Position.Y, -Hero.Height,
_ viewPortRectangle.Height + Hero.Height);
(currentLevel == 1)
{= 1;
}
/* 1 - gt; 2
*/(Hero.Position.X gt; 1080 amp; amp; currentLevel == 1)
{= 3; .Position.X=0;
}
/* 1 - gt; 2
*/(Hero.Position.X lt; -Hero.Width + 10 amp; amp; currentLevel == 3)
{= 1; .Position.X=1080 - Hero.Width;
}
/* 1 - gt; 2
*/(Hero.Position.Y gt; 640 amp; amp; currentLevel == 1)
{= 4; .Position.Y=0;
}
/* 1 - gt; 2
*/(Hero.Position.Y lt; -Hero.Height + 10 amp; amp; currentLevel == 4)
{= 1; .Position.Y=640 - Hero.Height;
}
/* 1 - gt; 2
*/(Hero.Position.X gt; 1080 amp; amp; currentLevel == 4)
{= 2; .Position.X=0;
}
/* 1 - gt; 2
*/(Hero.Position.X lt; -Hero.Width + 10 amp; amp; currentLevel == 2)
{= 4; .Position.X=1080 - Hero.Width;
}
/* 1 - gt; 2
*/(H...