Changes

Jump to navigation Jump to search
563 bytes added ,  02:55, 6 September 2023
add info about WorldMapManager
Line 398: Line 398:  
     }
 
     }
 
]
 
]
 +
</syntaxhighlight>
 +
 +
==Interacting with the world map in C#==
 +
SMAPI mods (written in C#) can use the game's <samp>StardewValley.WorldMaps.WorldMapManager</samp> class to interact with the world map.
 +
 +
For example, you can get the pixel position on the world map which matches an in-game tile coordinate (if the location appears in <samp>Data/WorldMap</samp>):
 +
 +
<syntaxhighlight lang="c#">
 +
MapAreaPosition mapAreaPosition = WorldMapManager.GetPositionData(location, tile);
 +
if (mapAreaPosition != null)
 +
    return mapAreaPosition.GetMapPixelPosition(location, tile);
 
</syntaxhighlight>
 
</syntaxhighlight>
    
[[Category:Modding]]
 
[[Category:Modding]]
translators
8,447

edits

Navigation menu