Changes

Jump to navigation Jump to search
+ tiles and positions
Line 3: Line 3:  
This page explains some of the Stardew Valley fundamentals that are useful for modders. See also [[Modding:Common tasks]].
 
This page explains some of the Stardew Valley fundamentals that are useful for modders. See also [[Modding:Common tasks]].
   −
==Data structures==
+
==Concepts==
 +
===Tiles===
 +
The world is laid out as a grid of ''tiles''. Each tile has an (x, y) coordinate which represents its position on the map, where (0, 0) is the top-left tile. The ''x'' value increases towards the right, and ''y'' increases downwards. For example:
 +
[[File:Modding - creating an XNB mod - tile coordinates.png]]
 +
 
 +
===Positions===
 +
The game uses three related coordinate systems:
 +
* Things placed in the world have a ''[[#Tiles|tile position]]'', relative to the top-left corner of the map.
 +
* Things in the world may also have an ''absolute pixel position'', relative to the top-left corner of the map. To convert a tile coordinate to a pixel coordinate, multiply it by <tt>Game1.tileSize</tt>; divide by <tt>Game1.tileSize</tt> for the reverse.
 +
* Items are usually drawn on the screen using a ''screen pixel position'', relative to the top-left corner of the visible screen. To convert an absolute pixel coordinate to a screen coordinate, subtract it from <tt>Game1.viewport.X</tt> and <tt>Game1.viewport.Y</tt>.
 +
 
 
===Net fields===
 
===Net fields===
 
{{upcoming|1.3}}
 
{{upcoming|1.3}}
translators
8,446

edits

Navigation menu