World: move Tile to bottom of file

This commit is contained in:
Colin McMillen 2020-03-09 11:48:22 -04:00
parent bb910fbe58
commit 3fc8b49636

View File

@ -3,34 +3,9 @@ using Microsoft.Xna.Framework.Graphics;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
namespace SemiColinGames { namespace SemiColinGames {
public class Tile {
public static int CompareByX(Tile t1, Tile t2) {
return t1.Position.X.CompareTo(t2.Position.X);
}
private TextureRef texture;
private Rectangle textureSource;
public Tile(TextureRef texture, Rectangle textureSource, Rectangle position, bool isHazard) {
Position = position;
this.texture = texture;
this.textureSource = textureSource;
IsHazard = isHazard;
}
public Rectangle Position { get; private set; }
public bool IsHazard = false;
public void Draw(SpriteBatch spriteBatch) {
spriteBatch.Draw(
texture.Get, Position.Location.ToVector2(), textureSource, Color.White);
}
}
public class World { public class World {
public const int TileSize = 16; public const int TileSize = 16;
@ -193,4 +168,28 @@ namespace SemiColinGames {
} }
} }
} }
public class Tile {
public static int CompareByX(Tile t1, Tile t2) {
return t1.Position.X.CompareTo(t2.Position.X);
}
private TextureRef texture;
private Rectangle textureSource;
public Tile(TextureRef texture, Rectangle textureSource, Rectangle position, bool isHazard) {
Position = position;
this.texture = texture;
this.textureSource = textureSource;
IsHazard = isHazard;
}
public Rectangle Position { get; private set; }
public bool IsHazard = false;
public void Draw(SpriteBatch spriteBatch) {
spriteBatch.Draw(
texture.Get, Position.Location.ToVector2(), textureSource, Color.White);
}
}
} }