Приставки
Nintendo (Dendy)
Nintendo 64
Sega Genesis
Sega CD / 32x
Master System
Super Nintendo
Turbo Grafx 16
Sega Saturn
Sony PlayStation
GameBoy Advance
GameBoy / Color
Game Gear
Atari
Другие

Утилиты
Системные утилиты
GoodXXXX
Sega CD / 32x
Nintendo 64
Переводы, хакинг
Музыка

Мир приставочных игр

Версия 2.00a

Leonis © 2002-2009
Команда Новости Помощь Ссылки
ПОМОЩЬ
Литература про игры
Предыдущая Следующая

namespace Plarform

{

public class Gamel : Microsoft.Xna.Framework.Game

{

GraphicsDeviceManager graphics; ContentManager content; KeyboardState keyboardState; SpriteBatch spriteBatch; Sprite[] sprite = new Sprite[5]; private Texture2D backgroundl; private Texture2D background2; Random rand = new Random(); int j;

Sprite platform;

/// <summary> /// Конструктор /// <summary> public Gamel()

{

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();

/// <summary> /// Инициализация /// <summary>

protected override void Initialize()

{

for (int i = 0; sprite.Length > i;

sprite[i].spritePosition = new Vector2(rand.Next(10, Window.ClientBounds.Width - 500), j = j - 300);

}

platform.spritePosition = new Vector2(Window.ClientBounds.Width / 2, Window.ClientBounds.Height - 90);

base.Initialize();

}

/// <summary>

/// Загрузка компонентов игры /// <summary>

protected override void LoadGraphicsContent(bool loadAllContent)

{

if (loadAllContent)

{

spriteBatch = new SpriteBatch(graphics.GraphicsDevice);

backgroundl = content.Load<Texture2D>("Content\\Textures\\background1"); background2 = content.Load<Texture2D>("Content\\Textures\\background2"); platform.Load(content, "Content\\Textures\\platform");

sprite[0].Load(content, "Content\\Textures\\0"); sprite[1].Load(content, "Content\\Textures\\1"); sprite[2].Load(content, "Content\\Textures\\2"); sprite[3].Load(content, "Content\\Textures\\3"); sprite[4].Load(content, "Content\\Textures\\4");

} }

/// <summary>

/// Освобождаем ресурсы

/// <summary>

protected override void UnloadGraphicsContent(bool unloadAllContent)

{

if (unloadAllContent == true)

{

content.Unload();

}

/// <summary>

/// Обновляем состояние игры /// <summary>

protected override void Update(GameTime gameTime)

{

keyboardState = Keyboard.GetState();

if (keyboardState.IsKeyDown(Keys.Escape))

this.Exit();

double elapsed = gameTime.ElapsedGameTime.TotalSeconds; for (int i = 0; sprite.Length > i;

{ }

sprite[i].UpdateFrame(elapsed);

MoveSprite(); MovePlatform();

130 Устройства ввода


Предыдущая Следующая

Горяченькое

Друзья

Hosted by uCoz