# Minimap Creator [Out dated]

The module calculates blip positions based off the center point and the position of the part associated with a blip, the difference is then multiplied by a ratio(studs:pixels) to find the number of pixels(offset) the difference represents. Constants are used to prevent the offset from being too small or too large, they allow us to create a “trailing effect” show in the example below

How to use the module
The module returns a function which we will use to create a minimap, when we call the function, a table will be returned

module(FrameSize, FramePosition, CenterPoint, MapSize)

FrameSize is a table {number xScale, number xOffset, number yScale, number yOffset}.

FramePosition is a table {number x, number y, {number x, number y}} the third value in the table is the anchor point. FramePosition may also be false, if so, the position of the map will be the bottom left corner, or, the third value in the table may be ignored (the anchor point will be set to (0.5, 0.5)).

CenterPoint may be a part, table[{number x, number z}] or left false. If it’s a part, the central point will be set to the position of the part, if it’s a table, the central point will be set to the coordinates in the table and, if it’s left false, the central point will be (0, 0).

MapSize is a table {number x, number z} and will be used to work out ratios.

Example
local Minimap = module({0, 200, 0, 200}, false, {0, 0}, {512, 512})

Next, we will import the map
We’re going to import a map which has already been created now, if you want to create a map, I recommend RoRender Minimap Creator [RoRender]

Minimap:ImportMap(Map)

Map can be an image label or a frame.
NOTE: 1 pixel == 1 stud therefore, your image size should be your mapsizeX by mapsizeZ pixels

e.g. if your map was 512 x 512 studs, your image should be 512 x 512 pixels

I also recommend that you set the transparency of the image used to 1

Next, we’re going to import the main blip

Minimap:ImportMainBlip(Blip, Part, Orientation)

Blip is an ImageLabel or Frame.
Part is going to be used to calculate the offset of the map and the blip.
Orientation is a boolean, if true, the blip will rotate according to the orientation of the part associated with blip.

Example
Minimap:ImportMainBlip(game.ReplicatedStorage.Blips.PlayerBlip:Clone(), HumanoidRootPart, true)

If the part associated with main blip changes, we can call the function UpdateMainPart

Minimap:UpdateMainPart(Part)

Now, we can start adding blips

Minimap:ImportBlip(Blip, Part, Enabled)

Blip is an ImageLabel or Frame.
Part is the part associated with the blip.
Enabled is a boolean, if true, the blip will be visible/enabled or else, it will be invisible/disabled.

To enable a blip, we can call the function EnableBlip

Minimap:EnableBlip(Part)

Part will be used to find the blip associated with it and make it visible.
Calculations will be done on parts associated with blips when enabled to prevent unnecessary calculations from being done

To disable a blip, we can call the function DisableBlip

Minimap:DisableBlip(Part)

Part will be used to find the blip associated with it and make it invisible.
Calculations will not be done on parts associated with blips when disabled to prevent unnecessary calculations from being done

If the part of a blip changes, we can call the function UpdateBlipPart

Minimap:UpdateBlipPart(OldPart, NewPart)

OldPart is a reference to the part which was used to create the blip.
NewPart will be used in place of OldPart.

If the icon of a blip changes, we can call the function UpdateBlipIcon

Minimap:UpdateBlipIcon(Part, Blip)

Part is going to be used to find the old blip icon and, it will be replaced with Blip.
Blip is an ImageLabel or Frame.

To remove a blip, we can call the function RemoveBlip

Minimap:RemoveBlip(Part)

Part is going to be used to find the blip and remove it including references to it.

Note
MainBlip will be parented to the map which will be parented to the frame created.
Blips will be parented to the frame created (excluding MainBlip)
If you are using scale, you should change the scale of blips accordingly.

Magnitude Checks won’t be done by the module to decrease load on the module, instead, you can use the functions EnableBlip and DisableBlip when certain conditions are true.

Minimap:DontClipBlipIcons()

The function stated above will prevent blips from being clipped so you can get this effect

Example Place:

Module:

Update 1

You can now import multiple maps, if a map was previously imported, it will be removed if a new map is imported.
If you import a new map, you can set the new center point using…

Minimap:SetCenterPoint(Center)

Center is a table {number x, number z} where x and z are coordinates from worldspace or, it may also be a part which is at the center of the map.
(where the center point in world space is the center represented by the image used)
(Due to the nature of how Roblox clips descendants, using a map with a Rotation other than 0 won’t work)
If the size of the map changes, you can call the function

Minimap:SetMapSize(Size)

Size is a table {number x, number z} where x and z represent the dimensions (in studs) of your map in worldspace.

Update 2

You can now prevent blips from being clipped by calling the function

Minimap:DontClipBlipIcons()

before you begin importing any blips.

when the function stated above is called, the frame used to display the map will be cloned; all descendants will be removed and ClipsDescendants will be set to false, it will be used to display blips instead of using the frame used to display the map to display blips.