|
@ -26,6 +26,8 @@ namespace Jumpy { |
|
|
FpsCounter fpsCounter = new FpsCounter(); |
|
|
FpsCounter fpsCounter = new FpsCounter(); |
|
|
Player player; |
|
|
Player player; |
|
|
Texture2D grassland; |
|
|
Texture2D grassland; |
|
|
|
|
|
Texture2D grasslandBg1; |
|
|
|
|
|
Texture2D grasslandBg2; |
|
|
|
|
|
|
|
|
public JumpyGame() { |
|
|
public JumpyGame() { |
|
|
graphics = new GraphicsDeviceManager(this); |
|
|
graphics = new GraphicsDeviceManager(this); |
|
@ -54,6 +56,8 @@ namespace Jumpy { |
|
|
font = Content.Load<SpriteFont>("font"); |
|
|
font = Content.Load<SpriteFont>("font"); |
|
|
player = new Player(Content.Load<Texture2D>("player_1x")); |
|
|
player = new Player(Content.Load<Texture2D>("player_1x")); |
|
|
grassland = Content.Load<Texture2D>("grassland"); |
|
|
grassland = Content.Load<Texture2D>("grassland"); |
|
|
|
|
|
grasslandBg1 = Content.Load<Texture2D>("grassland_bg1"); |
|
|
|
|
|
grasslandBg2 = Content.Load<Texture2D>("grassland_bg2"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Called once per game. Unloads all game content.
|
|
|
// Called once per game. Unloads all game content.
|
|
@ -94,6 +98,12 @@ namespace Jumpy { |
|
|
GraphicsDevice.Clear(Color.CornflowerBlue); |
|
|
GraphicsDevice.Clear(Color.CornflowerBlue); |
|
|
spriteBatch.Begin(); |
|
|
spriteBatch.Begin(); |
|
|
|
|
|
|
|
|
|
|
|
// Draw background.
|
|
|
|
|
|
Rectangle bgSource = new Rectangle(0, grasslandBg1.Height - Camera.Height, Camera.Width, Camera.Height); |
|
|
|
|
|
Rectangle bgTarget = new Rectangle(0, 0, Camera.Width, Camera.Height); |
|
|
|
|
|
spriteBatch.Draw(grasslandBg2, bgTarget, bgSource, Color.White); |
|
|
|
|
|
spriteBatch.Draw(grasslandBg1, bgTarget, bgSource, Color.White); |
|
|
|
|
|
|
|
|
// Draw player.
|
|
|
// Draw player.
|
|
|
player.Draw(gameTime, spriteBatch); |
|
|
player.Draw(gameTime, spriteBatch); |
|
|
|
|
|
|
|
|