Digital Leadership & Soft Skills

Небольшая справка по MonoGame

Опубликовано by Pavel Nakonechnyy on (изменено: ) в GameDev.

Очищение и заливка

GraphicsDevice.Clear(Color.CornflowerBlue);

Загрузка текстуры

texture = Content.Load<Texture2D>("knight");

Проверка нажатия клавиши

if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))

Отрисовка текстуры

spriteBatch.Draw(texture, new Vector2(50, 50), Color.White);

Параметры текстуры

texture.Width
texture.Height

Перегруженная отрисовка текстуры

spriteBatch.Draw(texture,
Vector2 Position,
Rectangle sourceRectangle,
Color color,
float rotation,
Vector2 origin,
float scale,
Sprite.Effects,
float layerDepth); // От 0 до 1

SpriteEffects

SpriteEffects.FlipHorizontally
SpriteEffects.FlipVertically




Коды клавиш




Обработка нажатий





Анимация спрайтов (массив)





Анимация спрайтов (rectangle)

Source: Blog

227