Предыдущая Следующая
/// Автор книги: Горнаков С. Г.
/// Глава 14
/// Проект: NewLevels
/// Класс: Gamel
/// Новые уровни
/// <summary>
//=========================================================================
#region Using Statements using System;
using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Storage; #endregion
namespace NewLevels
{
public class Gamel : Microsoft.Xna.Framework.Game
{
GraphicsDeviceManager graphics; ContentManager content; KeyboardState keyboardState; SpriteBatch spriteBatch;
Sprite[] sprite = new Sprite[5]; private Texture2D background1; private Texture2D background2; Random rand = new Random(); int j;
Sprite platform; private bool paused = false; private bool pauseKeyDown = false; public BoundingBox bbplatform;
public BoundingBox[] bb = new BoundingBox[5]; BitmapFont font;
int score0, score1, score2, score3, score4; Menu menu;
private bool menuState; private int cursorState; Sprite mouse; MouseState mouseState; public BoundingBox bbMouse; public BoundingBox bbCursorGame; public BoundingBox bbCursorExit; private int totalScore; private int endScore; private bool gameState; private bool levelState; private int level; private int tempLevel; private Texture2D gameLevel; private Texture2D pausedTexture;
/// <summary> /// Конструктор /// <summary> public Game1()
{
graphics = new GraphicsDeviceManager(this); content = new ContentManager(Services); graphics.PreferredBackBufferWidth = 1024; graphics.PreferredBackBufferHeight = 7 68; graphics.PreferMultiSampling = false; graphics.IsFullScreen = true; for (int i = 0; sprite.Length > i;
{
sprite[i] = new Sprite(12, 10);
}
platform = new Sprite();
font = new BitmapFont("Content\\Font\\russian.xml");
menu = new Menu();
menuState = true;
cursorState = 1;
mouse = new Sprite();
bbMouse = new BoundingBox();
bbCursorGame = new BoundingBox();
bbCursorExit = new BoundingBox();
level = 1;
226 Добавляем в игру новые уровни
Проект NewLevels 227
tempLevel = level; gameState = false; levelState = false;
}
/// <summary> /// Инициализация /// <summary>
protected override void Initialize()
{
Sound.Initialize(); base.Initialize();
}
/// <summary>
/// Загрузка компонентов игры /// <summary>
protected override void LoadGraphicsContent(bool loadAllContent) Предыдущая Следующая
|