public Player(string color, int size, Cords cords) { Id = Guid.NewGuid(); Color = color; Size = size; Cords = cords; }
private Cords WallCollition(Cords cords, int objectSize) { // Up if (cords.Y < 0) cords.Y = 0; // Right if (cords.X + objectSize > Width) cords.X = Width - objectSize; // Down if (cords.Y + objectSize > Height) cords.Y = Height - objectSize; // Left if (cords.X < 0) cords.X = 0; return cords; }
// Collition handlers private bool PointCollition(Cords playerCords, int playerSize) { for (var y = 0; y < playerSize; y++) { for (var x = 0; x < playerSize; x++) { var currentY = playerCords.Y + y; var currentX = playerCords.X + x; if ( currentY >= PointBlip.Cords.Y && currentY < PointBlip.Cords.Y + PointBlip.Size && currentX >= PointBlip.Cords.X && currentX < PointBlip.Cords.X + PointBlip.Size ) return true; } } return false; }