tasting on MonoGame
[tastes.git] / Platformer2D / Platformer2D.Core / Game / Tile.cs
blob2ba667faa6e3cbee39c08ad6ee9c6848d5a50eab
1 #region File Description
2 //-----------------------------------------------------------------------------
3 // Tile.cs
4 //
5 // Microsoft XNA Community Game Platform
6 // Copyright (C) Microsoft Corporation. All rights reserved.
7 //-----------------------------------------------------------------------------
8 #endregion
10 using System;
11 using Microsoft.Xna.Framework;
12 using Microsoft.Xna.Framework.Graphics;
14 namespace Platformer2D
16 /// <summary>
17 /// Controls the collision detection and response behavior of a tile.
18 /// </summary>
19 enum TileCollision
21 /// <summary>
22 /// A passable tile is one which does not hinder player motion at all.
23 /// </summary>
24 Passable = 0,
26 /// <summary>
27 /// An impassable tile is one which does not allow the player to move through
28 /// it at all. It is completely solid.
29 /// </summary>
30 Impassable = 1,
32 /// <summary>
33 /// A platform tile is one which behaves like a passable tile except when the
34 /// player is above it. A player can jump up through a platform as well as move
35 /// past it to the left and right, but can not fall down through the top of it.
36 /// </summary>
37 Platform = 2,
40 /// <summary>
41 /// Stores the appearance and collision behavior of a tile.
42 /// </summary>
43 struct Tile
45 public Texture2D Texture;
46 public TileCollision Collision;
48 public const int Width = 40;
49 public const int Height = 32;
51 public static readonly Vector2 Size = new Vector2(Width, Height);
53 /// <summary>
54 /// Constructs a new tile.
55 /// </summary>
56 public Tile(Texture2D texture, TileCollision collision)
58 Texture = texture;
59 Collision = collision;