Fixed the discrepancy between the screen coords and the game coords and also fixed mouse problem when zoomed out too far.

This commit is contained in:
2020-06-23 04:18:00 -06:00
parent c464d19857
commit 86cc05f0d7
42 changed files with 316 additions and 3472 deletions

View File

@@ -4,7 +4,8 @@ using Collector.Character;
namespace Collector.Dimension
{
public static class World {
private static void GenerateWorld(int x, int y) {
private static void GenerateWorld(int x, int y)
{
if (Chunks.IsEmpty(x, y)) {
Chunks.GenerateChunk(x, y);
}
@@ -21,8 +22,8 @@ namespace Collector.Dimension
for (var i = -(IRestrictions.RenderDistance); i < IRestrictions.RenderDistance; i++) {
for (var j = -(IRestrictions.RenderDistance); j < IRestrictions.RenderDistance; j++) {
GenerateWorld(
i + Player.X / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize),
j + Player.Y / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)
i + Player.X / (IRestrictions.SuperChunkSize * IRestrictions.ChunkSize),
j + Player.Y / (IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)
);
}
}
@@ -32,23 +33,23 @@ namespace Collector.Dimension
for (var i = -IRestrictions.RenderDistance; i < IRestrictions.RenderDistance+1; i++) {
//Down
UngenerateWorld(
Player.X / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)+i,
(Player.Y / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize))+3
Player.X / (IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)+i,
(Player.Y / (IRestrictions.SuperChunkSize * IRestrictions.ChunkSize))+IRestrictions.RenderDistance
);
//Up
UngenerateWorld(
Player.X / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)+i-1,
(Player.Y / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize))-4
Player.X / (IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)+i,
(Player.Y / (IRestrictions.SuperChunkSize * IRestrictions.ChunkSize))-IRestrictions.RenderDistance
);
//Right
UngenerateWorld(
Player.X / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)-4,
(Player.Y / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize))+i
Player.X / (IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)-IRestrictions.RenderDistance,
(Player.Y / (IRestrictions.SuperChunkSize * IRestrictions.ChunkSize))+i
);
//Left
UngenerateWorld(
Player.X / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)+3,
(Player.Y / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize))+i
Player.X / (IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)+IRestrictions.RenderDistance,
(Player.Y / (IRestrictions.SuperChunkSize * IRestrictions.ChunkSize))+i
);
}
}