Изменения

Перейти к навигации Перейти к поиску
м
Нет описания правки
Строка 128: Строка 128:  
Действия аналогичны TerrainFeatures, за исключением того, что нельзя размещать объекты за пределами карты.
 
Действия аналогичны TerrainFeatures, за исключением того, что нельзя размещать объекты за пределами карты.
   −
==Player==
+
==Игрок==
 
//todo describe section
 
//todo describe section
===Position===
+
===Местоположение===
 
A Character's position indicates the Character's coordinates in the current location.  
 
A Character's position indicates the Character's coordinates in the current location.  
 +
Позиция персонажа указывает координаты персонажа в текущей локации.
 +
====Позиция игрока на карте====
 +
Каждая локация представлена ``xTile`` картой, где левых верхний угол имеет координаты ''(0, 0)'' пикселей, а правый нижний - ''(location.Map.DisplayWidth, location.Map.DisplayHeight)'' пикселей.
   −
====Position Relative to the Map====
+
There are two ways to get a Character's position in the current location: by absolute position and by tile position.
Each location has an ``xTile`` map where the top-left corner of the map is ''(0, 0)'' and the bottom-right corner of the map is ''(location.Map.DisplayWidth, location.Map.DisplayHeight)'' in pixels.  
+
Существуют два способа узнать текущее местоположение персонажа в локации: по абсолютной позиции или по координатам тайла.
   −
There are two ways to get a Character's position in the current location: by absolute position and by tile position.
+
<code>Position.X</code> и <code>Position.Y</code> вернут координаты XY в пикселях.
   −
<code>Position.X</code> and <code>Position.Y</code> will give the XY coordinates in pixels.
+
<code>getTileX()</code> и <code>getTileY()</code> вернут координаты XY тайла в сетке тайл-листа.
   −
<code>getTileX()</code> and <code>getTileY()</code> will give the XY coordinates in tiles.
+
Согласно <code>Game1.tileSize</code> тайл имеет размер 64x64  пикселей. Это дает возможность конвертировать абсолютную и относительную позиции:
   −
Each tile is 64x64 pixels as specified by <code>Game1.tileSize</code>. The conversion between absolute and tile is as follows:
   
<source lang='c#'>
 
<source lang='c#'>
// Absolute position => Tile position
+
// Абсолютная позиция => Позиция тайла
 
Math.Floor(Game1.player.Position.X / Game1.tileSize)
 
Math.Floor(Game1.player.Position.X / Game1.tileSize)
 
Math.Floor(Game1.player.Position.Y / Game1.tileSize)
 
Math.Floor(Game1.player.Position.Y / Game1.tileSize)
   −
// Tile position => Absolute position
+
// Позиция тайла => Абсолютная позиция
 
Game1.player.getTileX() * Game1.tileSize
 
Game1.player.getTileX() * Game1.tileSize
 
Game1.player.getTileY() * Game1.tileSize
 
Game1.player.getTileY() * Game1.tileSize
   −
// Tilemap dimensions
+
// Размеры тайла
 
Math.Floor(Game1.player.currentLocation.Map.DisplayWidth / Game1.tileSize)
 
Math.Floor(Game1.player.currentLocation.Map.DisplayWidth / Game1.tileSize)
 
Math.Floor(Game1.player.currentLocation.Map.DisplayHeight / Game1.tileSize)
 
Math.Floor(Game1.player.currentLocation.Map.DisplayHeight / Game1.tileSize)
 
</source>
 
</source>
   −
====Position Relative to the Viewport====
+
====Позиция игрока в видимой области====
The viewport represents the visible area on the screen. Its dimensions are <code>Game1.viewport.Width</code> by <code>Game1.viewport.Height</code> in pixels; this is the same as the game's screen resolution.
+
Размеры видимой области экрана можно узнать используя <code>Game1.viewport.Width</code> и <code>Game1.viewport.Height</code>. Размеры указаны в пикселях и соответствуют разрешению экрана игры.
 
+
The viewport also has an absolute position relative to the map, where the top-left corner of the viewport is at ''(Game1.viewport.X, Game1.viewport.Y)''.  
+
Также видимая область имеет абсолютную позицию относительно карты, где левый верхний угол находится в ''(Game1.viewport.X, Game1.viewport.Y)''.
 
     −
The player's position in pixels relative to the viewport is as follows:
+
Позиция игрока относительно видимой области вычисляется следующим образом:
 
<source lang='c#'>
 
<source lang='c#'>
 
Game1.player.Position.X - Game1.viewport.X
 
Game1.player.Position.X - Game1.viewport.X
5

правок

Навигация