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]] |