diff --git a/Collector/Content/man.png b/Collector/Content/man.png index aa2beb9..c436481 100644 Binary files a/Collector/Content/man.png and b/Collector/Content/man.png differ diff --git a/Collector/Main.cs b/Collector/Main.cs index 0a3047d..21445c5 100644 --- a/Collector/Main.cs +++ b/Collector/Main.cs @@ -19,8 +19,8 @@ namespace Collector private Player _player; private PlayerMouse _playerMouse; private static OrthographicCamera _cam; - public static int VirtualWidth; - public static int VirtualHeight; + private static int _virtualWidth; + private static int _virtualHeight; private WorldRenderer WorldRenderer { get; set; } public static Dictionary Materials { get; } = new Dictionary(); @@ -29,8 +29,10 @@ namespace Collector { _graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; + IsMouseVisible = true; IsFixedTimeStep = true; + _graphics.PreferMultiSampling = true; } protected override void Initialize() @@ -43,18 +45,18 @@ namespace Collector Materials.Add(name,Content.Load(name.ToString())); } - VirtualWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width; - VirtualHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height; + _virtualWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width; + _virtualHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height; - var viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, VirtualWidth, VirtualHeight); + var viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, _virtualWidth, _virtualHeight); _player = new Player(0, 0); _cam = new OrthographicCamera(viewportAdapter); - _cam.LookAt(new Vector2(Player.X+IRestrictions.TileSize/2, Player.Y+IRestrictions.TileSize/2)); + _cam.LookAt(new Vector2(Player.X, Player.Y)); _cam.Zoom = IRestrictions.Zoom; _spriteBatch = new SpriteBatch(GraphicsDevice); _playerMouse = new PlayerMouse(Content, _spriteBatch, _cam); - _inputController = new InputController(_playerMouse, _cam, _spriteBatch, Content); + _inputController = new InputController(_cam, _spriteBatch, Content); WorldRenderer = new WorldRenderer(_playerMouse, _inputController, _spriteBatch, this); } @@ -71,7 +73,8 @@ namespace Collector var transformMatrix = _cam.GetViewMatrix(); base.Draw(gameTime); GraphicsDevice.Clear(Color.CornflowerBlue); - _spriteBatch.Begin(transformMatrix: transformMatrix); + //Turn on Anti-aliasing by changing SamplerState.PointClamp + _spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullNone, transformMatrix: transformMatrix); _playerMouse.Draw(); WorldRenderer.Draw(gameTime); _spriteBatch.End(); diff --git a/Collector/Restrictions.cs b/Collector/Restrictions.cs index 5ab03bb..58200d7 100644 --- a/Collector/Restrictions.cs +++ b/Collector/Restrictions.cs @@ -8,18 +8,19 @@ namespace Collector { public interface IRestrictions { - public const int Seed = 1; + public const int Seed = 3; public const int TileSize = 1; public const float ViewportHeight = 9f; public const float ViewportWidth = 16f; - public const int MovementSpeed = 1; + public const float MovementSpeed = 4/32f; public const int KeyDelay = 20; public const int ChunkSize = 8; public const int SuperChunkSize = 1; public const int ChunkShift = 3; public const int RenderDistance = 5; public const float RenderTime = 1/60f; - public const float Zoom = 30; + public const float Zoom = 69; public const float Scale = ViewportWidth/ViewportHeight; + public const float AnimationDuration = 0.3f; } } \ No newline at end of file diff --git a/Collector/src/Character/Collision.cs b/Collector/src/Character/Collision.cs new file mode 100644 index 0000000..c97e75c --- /dev/null +++ b/Collector/src/Character/Collision.cs @@ -0,0 +1,17 @@ + +using Humper.Base; + +namespace Collector.Character +{ + public class Collision + { + private readonly int _tileWidth; + public RectangleF Rectangle { get; private set; } + + public Collision(int x, int y,int tileWidth) + { + _tileWidth = tileWidth; + Rectangle = new RectangleF(x,y,tileWidth,tileWidth); + } + } +} \ No newline at end of file diff --git a/Collector/src/Character/InputController.cs b/Collector/src/Character/InputController.cs index da745d4..dbdd9d6 100644 --- a/Collector/src/Character/InputController.cs +++ b/Collector/src/Character/InputController.cs @@ -10,20 +10,18 @@ namespace Collector.Character { public class InputController : IRestrictions { - private readonly PlayerMouse _playerMouse; private readonly OrthographicCamera _cam; private readonly Dictionary _animations; private readonly Texture2D _texture; private readonly SpriteBatch _spriteBatch; private string Input { get; set; } private int _frameNumber; - private int _timeSinceLastFrame; + private float _timeSinceLastFrame; - public InputController(PlayerMouse playerMouse, OrthographicCamera cam, SpriteBatch spriteBatch, ContentManager contentManager) + public InputController(OrthographicCamera cam, SpriteBatch spriteBatch, ContentManager contentManager) { Input = "Down"; - _playerMouse = playerMouse; _cam = cam; _spriteBatch = spriteBatch; _frameNumber = 0; @@ -31,128 +29,128 @@ namespace Collector.Character const int tileSize = 32; _animations = new Dictionary { + ["Idle"] = new[] + { + new Rectangle((0 + 4)*tileSize, 0, tileSize, tileSize*2), + new Rectangle((0 + 4)*tileSize, 0, tileSize, tileSize*2), + new Rectangle((0 + 4)*tileSize, 0, tileSize, tileSize*2), + new Rectangle((0 + 4)*tileSize, 0, tileSize, tileSize*2), + }, ["Up"] = new[] { - new Rectangle(0, 0, tileSize, tileSize), - new Rectangle(1, 0, tileSize, tileSize), - new Rectangle(2, 0, tileSize, tileSize), - new Rectangle(3, 0, tileSize, tileSize) + new Rectangle(0*tileSize, 0, tileSize, tileSize*2), + new Rectangle(1*tileSize, 0, tileSize, tileSize*2), + new Rectangle(2*tileSize, 0, tileSize, tileSize*2), + new Rectangle(3*tileSize, 0, tileSize, tileSize*2) }, ["Right"] = new[] { - new Rectangle(0 + 4, 1, tileSize, tileSize), - new Rectangle(1 + 4, 1, tileSize, tileSize), - new Rectangle(2 + 4, 1, tileSize, tileSize), - new Rectangle(3 + 4, 1, tileSize, tileSize) + new Rectangle((0 + 4)*tileSize, 2*tileSize, tileSize, tileSize*2), + new Rectangle((1 + 4)*tileSize, 2*tileSize, tileSize, tileSize*2), + new Rectangle((2 + 4)*tileSize, 2*tileSize, tileSize, tileSize*2), + new Rectangle((3 + 4)*tileSize, 2*tileSize, tileSize, tileSize*2) }, ["UpRight"] = new[] { - new Rectangle(0 + 4, 2, tileSize, tileSize), - new Rectangle(1 + 4, 2, tileSize, tileSize), - new Rectangle(2 + 4, 2, tileSize, tileSize), - new Rectangle(3 + 4, 2, tileSize, tileSize) + new Rectangle((0 + 4)*tileSize, 4*tileSize, tileSize, tileSize*2), + new Rectangle((1 + 4)*tileSize, 4*tileSize, tileSize, tileSize*2), + new Rectangle((2 + 4)*tileSize, 4*tileSize, tileSize, tileSize*2), + new Rectangle((3 + 4)*tileSize, 4*tileSize, tileSize, tileSize*2) }, ["DownRight"] = new[] { - new Rectangle(0 + 4, 3, tileSize, tileSize), - new Rectangle(1 + 4, 3, tileSize, tileSize), - new Rectangle(2 + 4, 3, tileSize, tileSize), - new Rectangle(3 + 4, 3, tileSize, tileSize) + new Rectangle((0 + 4)*tileSize, 6*tileSize, tileSize, tileSize*2), + new Rectangle((1 + 4)*tileSize, 6*tileSize, tileSize, tileSize*2), + new Rectangle((2 + 4)*tileSize, 6*tileSize, tileSize, tileSize*2), + new Rectangle((3 + 4)*tileSize, 6*tileSize, tileSize, tileSize*2) }, ["Left"] = new[] { - new Rectangle(0, 1, tileSize, tileSize), - new Rectangle(1, 1, tileSize, tileSize), - new Rectangle(2, 1, tileSize, tileSize), - new Rectangle(3, 1, tileSize, tileSize) + new Rectangle(0*tileSize, 2*tileSize, tileSize, tileSize*2), + new Rectangle(1*tileSize, 2*tileSize, tileSize, tileSize*2), + new Rectangle(2*tileSize, 2*tileSize, tileSize, tileSize*2), + new Rectangle(3*tileSize, 2*tileSize, tileSize, tileSize*2) }, ["UpLeft"] = new[] { - new Rectangle(0, 2, tileSize, tileSize), - new Rectangle(1, 2, tileSize, tileSize), - new Rectangle(2, 2, tileSize, tileSize), - new Rectangle(3, 2, tileSize, tileSize) + new Rectangle(0*tileSize, 4*tileSize, tileSize, tileSize*2), + new Rectangle(1*tileSize, 4*tileSize, tileSize, tileSize*2), + new Rectangle(2*tileSize, 4*tileSize, tileSize, tileSize*2), + new Rectangle(3*tileSize, 4*tileSize, tileSize, tileSize*2) }, ["DownLeft"] = new[] { - new Rectangle(0, 1, tileSize, tileSize), - new Rectangle(1, 1, tileSize, tileSize), - new Rectangle(2, 1, tileSize, tileSize), - new Rectangle(3, 1, tileSize, tileSize) + new Rectangle(0*tileSize, 6*tileSize, tileSize, tileSize*2), + new Rectangle(1*tileSize, 6*tileSize, tileSize, tileSize*2), + new Rectangle(2*tileSize, 6*tileSize, tileSize, tileSize*2), + new Rectangle(3*tileSize, 6*tileSize, tileSize, tileSize*2) }, ["Down"] = new[] { - new Rectangle(0 + 4, 0, tileSize, tileSize), - new Rectangle(1 + 4, 0, tileSize, tileSize), - new Rectangle(2 + 4, 0, tileSize, tileSize), - new Rectangle(3 + 4, 0, tileSize, tileSize) + new Rectangle((0 + 4)*tileSize, 0, tileSize, tileSize*2), + new Rectangle((1 + 4)*tileSize, 0, tileSize, tileSize*2), + new Rectangle((2 + 4)*tileSize, 0, tileSize, tileSize*2), + new Rectangle((3 + 4)*tileSize, 0, tileSize, tileSize*2) }, }; } - public void PlayerInput(Main main, PlayerMouse playerMouse, GameTime gameTime) + public void PlayerInput(Main main, GameTime gameTime) { - const int movementSpeed = IRestrictions.MovementSpeed; + const float movementSpeed = IRestrictions.MovementSpeed; var keyboardState = Keyboard.GetState(); var mouseState = Mouse.GetState(); if (keyboardState.IsKeyDown(Keys.Escape)) { Quit(main); } - if (keyboardState.IsKeyUp(Keys.W) && keyboardState.IsKeyUp(Keys.A) && keyboardState.IsKeyUp(Keys.S) && keyboardState.IsKeyUp(Keys.D)) - { - Input = Input.Contains("Right") ? "DownRight" : "DownLeft"; - _frameNumber = 0; - _playerMouse.Draw(); + if (keyboardState.IsKeyUp(Keys.W) && keyboardState.IsKeyUp(Keys.A) && keyboardState.IsKeyUp(Keys.S) && + keyboardState.IsKeyUp(Keys.D)) + { + Input = "Idle"; } + UpdateAnimationFrame(gameTime); + const float diagonalMovement = 0.707f; if (keyboardState.IsKeyDown(Keys.W) && keyboardState.IsKeyDown(Keys.D)) { - UpdateAnimationFrame(gameTime); Input = "UpRight"; - Player.Move(_cam,movementSpeed,-movementSpeed); + Player.Move(_cam,movementSpeed*diagonalMovement,-movementSpeed*diagonalMovement); } else if (keyboardState.IsKeyDown(Keys.W) && keyboardState.IsKeyDown(Keys.A)) { - UpdateAnimationFrame(gameTime); + Player.Move(_cam,-movementSpeed*diagonalMovement,-movementSpeed*diagonalMovement); Input = "UpLeft"; - Player.Move(_cam,-movementSpeed,-movementSpeed); } else if (keyboardState.IsKeyDown(Keys.S) && keyboardState.IsKeyDown(Keys.D)) { - UpdateAnimationFrame(gameTime); Input = "DownRight"; - Player.Move(_cam,movementSpeed,movementSpeed); + Player.Move(_cam,movementSpeed*diagonalMovement,movementSpeed*diagonalMovement); } else if (keyboardState.IsKeyDown(Keys.S) && keyboardState.IsKeyDown(Keys.A)) { - UpdateAnimationFrame(gameTime); Input = "DownLeft"; - Player.Move(_cam,-movementSpeed,movementSpeed); + Player.Move(_cam,-movementSpeed*diagonalMovement,movementSpeed*diagonalMovement); } else if (keyboardState.IsKeyDown(Keys.W)) { - UpdateAnimationFrame(gameTime); Input = "Up"; Player.Move(_cam,0,-movementSpeed); } else if (keyboardState.IsKeyDown(Keys.A)) { - UpdateAnimationFrame(gameTime); - Player.Move(_cam,-movementSpeed,0); Input = "Left"; + Player.Move(_cam,-movementSpeed,0); } else if (keyboardState.IsKeyDown(Keys.S)) { - UpdateAnimationFrame(gameTime); - Player.Move(_cam,0,movementSpeed); Input = "Down"; + Player.Move(_cam,0,movementSpeed); } else if (keyboardState.IsKeyDown(Keys.D)) { - UpdateAnimationFrame(gameTime); - Player.Move(_cam,movementSpeed,0); Input = "Right"; + Player.Move(_cam,movementSpeed,0); } if (keyboardState.IsKeyDown(Keys.Q)) { @@ -162,7 +160,6 @@ namespace Collector.Character { _cam.ZoomOut(1f); } - if (mouseState.LeftButton == ButtonState.Pressed) { Chunks.RemoveBlock(PlayerMouse.GetSelectedX(),PlayerMouse.GetSelectedY()); @@ -175,14 +172,11 @@ namespace Collector.Character private void UpdateAnimationFrame(GameTime gameTime) { - _timeSinceLastFrame += gameTime.ElapsedGameTime.Milliseconds; - if (_timeSinceLastFrame <= 99) return; + _timeSinceLastFrame += gameTime.GetElapsedSeconds(); + if (_timeSinceLastFrame <= IRestrictions.AnimationDuration) return; _frameNumber++; _timeSinceLastFrame = 0; - if (_frameNumber > 3) - { - _frameNumber = 0; - } + if (_frameNumber > 3) _frameNumber = 0; } private static void Quit(Game main) @@ -193,11 +187,14 @@ namespace Collector.Character public void Draw() { _spriteBatch.Draw( - _texture - ,Player.PlayerBounds - ,_animations[Input][_frameNumber] - ,Color.White - ); + _texture, + new Vector2(Player.X,Player.Y), + _animations[Input][_frameNumber], + Color.White, 0f, + Vector2.One, + 1/32f, + SpriteEffects.None, + 1f); } } } \ No newline at end of file diff --git a/Collector/src/Dimension/Inventory.cs b/Collector/src/Character/Inventory.cs similarity index 100% rename from Collector/src/Dimension/Inventory.cs rename to Collector/src/Character/Inventory.cs diff --git a/Collector/src/Character/Player.cs b/Collector/src/Character/Player.cs index 84ad348..e768c68 100644 --- a/Collector/src/Character/Player.cs +++ b/Collector/src/Character/Player.cs @@ -1,35 +1,44 @@ using System; -using System.Collections.Generic; +using System.Linq; using Collector.Dimension; -using Humper; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Media; +using Microsoft.Xna.Framework.Graphics; using MonoGame.Extended; -using MonoGame.Extended.Collections; -using Collision = Collector.Dimension.Collision; +using RectangleF = Humper.Base.RectangleF; +using Vector2 = Microsoft.Xna.Framework.Vector2; + namespace Collector.Character { public class Player : IRestrictions { - public static int X { get; private set; } - public static int Y { get; private set; } - private static Dictionary Animation { get; set; } - public static Rectangle PlayerBounds; + public static float X { get; private set; } + public static float Y { get; private set; } + + public static RectangleF PlayerBounds; public Player(int x, int y) { - PlayerBounds = new Rectangle(X,Y,IRestrictions.TileSize,IRestrictions.TileSize); X = x; Y = y; + PlayerBounds = new RectangleF(x,y, IRestrictions.TileSize*0.5f, IRestrictions.TileSize*0.35f); } - public static void Move(OrthographicCamera cam, int x, int y) + public static void Move(OrthographicCamera cam, float x, float y) { X += x; Y += y; - cam.Move(new Vector2(x+IRestrictions.TileSize/2, y+IRestrictions.TileSize/2)); - PlayerBounds.Location = new Point(X,Y); + PlayerBounds.X = X+0.2f; + PlayerBounds.Y = Y+1.5f; + + cam.Move(new Vector2(x, y)); + if (!Chunks.loadedCollisions.Values.Any(collisionsValue => collisionsValue.Rectangle.Intersects(PlayerBounds))) return; + + X -= x; + Y -= y; + cam.Move(new Vector2(-x, -y)); + PlayerBounds.X -= X; + PlayerBounds.Y -= Y; } } } \ No newline at end of file diff --git a/Collector/src/Dimension/Autotiling.cs b/Collector/src/Dimension/Autotiling.cs new file mode 100644 index 0000000..36b729a --- /dev/null +++ b/Collector/src/Dimension/Autotiling.cs @@ -0,0 +1,7 @@ +namespace Collector.Character +{ + public class Autotiling + { + + } +} \ No newline at end of file diff --git a/Collector/src/Dimension/Chunks.cs b/Collector/src/Dimension/Chunks.cs index dcfdbbd..6b46f42 100644 --- a/Collector/src/Dimension/Chunks.cs +++ b/Collector/src/Dimension/Chunks.cs @@ -5,6 +5,8 @@ using System.Collections.Generic; using Collector.ThirdPartyCode; using Humper; using Microsoft.Xna.Framework; +using MonoGame.Extended; +using Collision = Collector.Character.Collision; namespace Collector.Dimension { @@ -13,7 +15,8 @@ namespace Collector.Dimension public static Dictionary, Blocks> LoadedChunks { get; } = new Dictionary, Blocks>(); private static readonly Dictionary, Blocks> SavedChunks = new Dictionary, Blocks>(); private static readonly Dictionary, Collision> savedCollisions = new Dictionary, Collision>(); - public static readonly Dictionary, Collision> loadedCollisions = new Dictionary, Collision>(); + public static readonly Dictionary, Collision> loadedCollisions = new Dictionary, Collision>(); + public static readonly List Impassable = new List(); private static readonly OpenSimplexNoise Gen1 = new OpenSimplexNoise(IRestrictions.Seed+ 1); @@ -32,8 +35,8 @@ namespace Collector.Dimension var tuple = new Tuple(x, y, z); var pair = new Tuple(x, y); - loadedCollisions[pair] = new Collision(x,y,IRestrictions.TileSize,false); - savedCollisions[pair] = new Collision(x,y,IRestrictions.TileSize,false); + loadedCollisions[pair] = new Collision(x,y,IRestrictions.TileSize); + savedCollisions[pair] = new Collision(x,y,IRestrictions.TileSize); LoadedChunks[tuple] = name; SavedChunks[tuple] = name; } @@ -55,16 +58,16 @@ namespace Collector.Dimension if (!LoadedChunks.ContainsKey(tuple)) return; if (LoadedChunks[tuple].Equals(Blocks.BlockAir)) return; - loadedCollisions[pair] = null; - savedCollisions[pair] = null; + loadedCollisions.Remove(pair); + savedCollisions.Remove(pair); LoadedChunks[tuple] = Blocks.BlockAir; SavedChunks[tuple] = Blocks.BlockAir; } - public static void UngenerateChunk(int x, int y) { - var startX = x << IRestrictions.ChunkShift; - var startY = y << IRestrictions.ChunkShift; + public static void UngenerateChunk(float x, float y) { + var startX = (int)x << IRestrictions.ChunkShift; + var startY = (int)y << IRestrictions.ChunkShift; var endX = startX + IRestrictions.ChunkSize; var endY = startY + IRestrictions.ChunkSize; @@ -83,9 +86,9 @@ namespace Collector.Dimension } } - public static void GenerateChunk(int x, int y) { - var startX = x << IRestrictions.ChunkShift; - var startY = y << IRestrictions.ChunkShift; + public static void GenerateChunk(float x, float y) { + var startX = (int)x << IRestrictions.ChunkShift; + var startY = (int)y << IRestrictions.ChunkShift; var endX = startX + IRestrictions.ChunkSize; var endY = startY + IRestrictions.ChunkSize; @@ -97,8 +100,16 @@ namespace Collector.Dimension LoadedChunks.Add(triple,SavedChunks[triple]); } else { - LoadedChunks.Add(triple, GetTerrain(i, j)); - SavedChunks.Add(triple, GetTerrain(i,j)); + var terrain = GetTerrain(i, j); + var pair = new Tuple(i, j); + if (Impassable.Contains(terrain)) + { + loadedCollisions[pair] = new Collision(i,j,IRestrictions.TileSize); + savedCollisions[pair] = new Collision(i,j,IRestrictions.TileSize); + } + + LoadedChunks.Add(triple, terrain); + SavedChunks.Add(triple, terrain); } } } @@ -147,7 +158,7 @@ namespace Collector.Dimension return GetBiomeBlock(moisture, elevation); } - + private static Blocks GetBiomeBlock(double moisture, double elevation) { var biome = GetBiome(moisture, elevation); if (biome.Equals("Tundra")) return Blocks.BlockSnow; @@ -196,8 +207,8 @@ namespace Collector.Dimension return moisture < 0.66 ? "TropicalSeasonalForest" : "TropicalRainForest"; } - public static bool IsEmpty(int x, int y){ - return !LoadedChunks.ContainsKey(new Tuple(x * 8, y * 8,0)); + public static bool IsEmpty(float x, float y){ + return !LoadedChunks.ContainsKey(new Tuple((int)x * 8, (int)y * 8,0)); } } } diff --git a/Collector/src/Dimension/Collision.cs b/Collector/src/Dimension/Collision.cs deleted file mode 100644 index feed5b7..0000000 --- a/Collector/src/Dimension/Collision.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Microsoft.Xna.Framework; - -namespace Collector.Dimension -{ - public class Collision - { - private readonly int _tileWidth; - private bool _entity; - public Rectangle Rectangle { get; private set; } - - public Collision(int x, int y,int tileWidth, bool entity) - { - _entity = entity; - _tileWidth = tileWidth; - Rectangle = new Rectangle(x,y,tileWidth,tileWidth); - } - } -} \ No newline at end of file diff --git a/Collector/src/Dimension/World.cs b/Collector/src/Dimension/World.cs index 7934a7d..865315a 100644 --- a/Collector/src/Dimension/World.cs +++ b/Collector/src/Dimension/World.cs @@ -4,14 +4,14 @@ using Collector.Character; namespace Collector.Dimension { public static class World { - private static void GenerateWorld(int x, int y) + private static void GenerateWorld(float x, float y) { if (Chunks.IsEmpty(x, y)) { Chunks.GenerateChunk(x, y); } } - private static void UngenerateWorld(int x, int y) { + private static void UngenerateWorld(float x, float y) { if (!Chunks.IsEmpty(x, y)) { Chunks.UngenerateChunk(x, y); } @@ -34,22 +34,22 @@ namespace Collector.Dimension //Down UngenerateWorld( Player.X / (IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)+i, - (Player.Y / (IRestrictions.SuperChunkSize * IRestrictions.ChunkSize))+IRestrictions.RenderDistance + Player.Y / (IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)+IRestrictions.RenderDistance ); //Up UngenerateWorld( Player.X / (IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)+i, - (Player.Y / (IRestrictions.SuperChunkSize * IRestrictions.ChunkSize))-IRestrictions.RenderDistance + Player.Y / (IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)-IRestrictions.RenderDistance ); //Right UngenerateWorld( Player.X / (IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)-IRestrictions.RenderDistance, - (Player.Y / (IRestrictions.SuperChunkSize * IRestrictions.ChunkSize))+i + Player.Y / (IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)+i ); //Left UngenerateWorld( Player.X / (IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)+IRestrictions.RenderDistance, - (Player.Y / (IRestrictions.SuperChunkSize * IRestrictions.ChunkSize))+i + Player.Y / (IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)+i ); } } diff --git a/Collector/src/Dimension/WorldRenderer.cs b/Collector/src/Dimension/WorldRenderer.cs index 8a65fa7..184d5f4 100644 --- a/Collector/src/Dimension/WorldRenderer.cs +++ b/Collector/src/Dimension/WorldRenderer.cs @@ -18,6 +18,9 @@ namespace Collector.Dimension _inputController = inputController; _spriteBatch = spriteBatch; _main = main; + Chunks.Impassable.Add(Blocks.BlockWater); + Chunks.Impassable.Add(Blocks.BlockRoof); + Chunks.Impassable.Add(Blocks.BlockWall); } private static void DrawWorld(SpriteBatch batch, int layer) @@ -40,10 +43,11 @@ namespace Collector.Dimension { //Higher means draws in a lower layer DrawWorld(_spriteBatch,0); + _playerMouse.Draw(); DrawWorld(_spriteBatch,1); _inputController.Draw(); - _inputController.PlayerInput(_main,_playerMouse,gameTime); - DrawWorld(_spriteBatch,2); + _inputController.PlayerInput(_main,gameTime); + //DrawWorld(_spriteBatch,2); } } } \ No newline at end of file