diff --git a/Shared/NPC.cs b/Shared/NPC.cs index a9b9519..5c02db6 100644 --- a/Shared/NPC.cs +++ b/Shared/NPC.cs @@ -122,7 +122,7 @@ namespace SemiColinGames { SpriteEffects effect = Facing == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; Color color = Color.White; - spriteBatch.Draw(Textures.Executioner.Get, Vector2.Round(Position), textureSource, color, 0f, + spriteBatch.Draw(Textures.Executioner.Get, Vectors.Round(Position), textureSource, color, 0f, spriteCenter, Vector2.One, effect, 0f); } } diff --git a/Shared/Player.cs b/Shared/Player.cs index ef88354..09203a3 100644 --- a/Shared/Player.cs +++ b/Shared/Player.cs @@ -249,7 +249,7 @@ namespace SemiColinGames { if (invincibilityTime > 0 && invincibilityTime % 0.2f > 0.1f) { color = new Color(0.5f, 0.5f, 0.5f, 0.5f); } - spriteBatch.Draw(Textures.Ninja.Get, Vector2.Floor(position), textureSource, color, 0f, + spriteBatch.Draw(Textures.Ninja.Get, Vectors.Floor(position), textureSource, color, 0f, spriteCenter, Vector2.One, effect, 0f); } } diff --git a/Shared/Shared.projitems b/Shared/Shared.projitems index 3b319f4..6928d7b 100644 --- a/Shared/Shared.projitems +++ b/Shared/Shared.projitems @@ -42,5 +42,6 @@ + \ No newline at end of file diff --git a/Shared/ShmupWorld.cs b/Shared/ShmupWorld.cs index e7d86d3..611768b 100644 --- a/Shared/ShmupWorld.cs +++ b/Shared/ShmupWorld.cs @@ -38,7 +38,7 @@ namespace SemiColinGames { public void Draw(SpriteBatch spriteBatch) { Texture2D texture = Texture.Get; Vector2 spriteCenter = new Vector2(texture.Width / 2, texture.Height / 2); - Vector2 drawPos = Vector2.Floor(Vector2.Subtract(Position, spriteCenter)); + Vector2 drawPos = Vectors.Floor(Vector2.Subtract(Position, spriteCenter)); spriteBatch.Draw(texture, drawPos, Color.White); } } @@ -78,7 +78,7 @@ namespace SemiColinGames { public void Draw(SpriteBatch spriteBatch) { Texture2D texture = Texture.Get; Vector2 center = new Vector2(texture.Width / 2, texture.Height / 2); - spriteBatch.Draw(texture, Vector2.Floor(Vector2.Subtract(Position, center)), Color.White); + spriteBatch.Draw(texture, Vectors.Floor(Vector2.Subtract(Position, center)), Color.White); } } @@ -115,7 +115,7 @@ namespace SemiColinGames { public void Draw(SpriteBatch spriteBatch) { Texture2D texture = Texture.Get; Vector2 spriteCenter = new Vector2(texture.Width / 2, texture.Height / 2); - Vector2 drawPos = Vector2.Floor(Vector2.Subtract(Position, spriteCenter)); + Vector2 drawPos = Vectors.Floor(Vector2.Subtract(Position, spriteCenter)); spriteBatch.Draw(texture, drawPos, null, Color.White, 0f, spriteCenter, Vector2.One, SpriteEffects.FlipHorizontally, 0f); } diff --git a/Shared/SpiderWorld.cs b/Shared/SpiderWorld.cs index 62ce8fc..7c16f62 100644 --- a/Shared/SpiderWorld.cs +++ b/Shared/SpiderWorld.cs @@ -36,7 +36,7 @@ namespace SemiColinGames { public void Draw(SpriteBatch spriteBatch) { Texture2D texture = Texture.Get; Vector2 spriteCenter = new Vector2(texture.Width / 2, texture.Height / 2); - Vector2 drawPos = Vector2.Floor(Vector2.Subtract(Position, spriteCenter)); + Vector2 drawPos = Vectors.Floor(Vector2.Subtract(Position, spriteCenter)); spriteBatch.Draw(texture, drawPos, Color.White); } } @@ -52,7 +52,7 @@ namespace SemiColinGames { public void Draw(SpriteBatch spriteBatch) { Texture2D texture = Texture.Get; Vector2 spriteCenter = new Vector2(texture.Width / 2, texture.Height / 2); - Vector2 drawPos = Vector2.Floor(Vector2.Subtract(Position, spriteCenter)); + Vector2 drawPos = Vectors.Floor(Vector2.Subtract(Position, spriteCenter)); spriteBatch.Draw(texture, drawPos, Color.White); } } diff --git a/Shared/Vectors.cs b/Shared/Vectors.cs new file mode 100644 index 0000000..ea0c795 --- /dev/null +++ b/Shared/Vectors.cs @@ -0,0 +1,15 @@ +using Microsoft.Xna.Framework; +using System; + +namespace SemiColinGames { + public static class Vectors { + public static Vector2 Floor(Vector2 v) { + return new Vector2((float) Math.Floor(v.X), (float) Math.Floor(v.Y)); + } + + public static Vector2 Round(Vector2 v) { + return new Vector2((float) Math.Round(v.X), (float) Math.Round(v.Y)); + } + + } +}