Exemplo n.º 1
0
 /// <summary>
 /// Places a new sprite on the map. The sprite's Advance() method is not executed
 /// until next frame.
 /// </summary>
 /// <param name="sprite"></param>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <param name="layer"></param>
 internal void Place(Sprite sprite, int x, int y, int layer)
 {
     layers[layer].objects[x, y].Add(sprite);
     addList.Add(sprite);
     sprite.UpdateCoords(x, y, layer);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Moves a sprite from one place to another.
 /// </summary>
 /// <param name="sprite"></param>
 /// <param name="fromX"></param>
 /// <param name="fromY"></param>
 /// <param name="fromLayer"></param>
 /// <param name="toX"></param>
 /// <param name="toY"></param>
 /// <param name="toLayer"></param>
 internal void Move(Sprite sprite, int fromX, int fromY, int fromLayer, int toX, int toY, int toLayer)
 {
     layers[fromLayer].objects[fromX, fromY].Remove(sprite);
     if (layers[toLayer].ladderMove[toX, toY] != null) {
         layers[toLayer].ladderMove[toX, toY].objects[toX, toY].Add(sprite);
         sprite.UpdateCoords(toX, toY, Array.IndexOf(layers, layers[toLayer].ladderMove[toX, toY]));
     }
     else {
         layers[toLayer].objects[toX, toY].Add(sprite);
         sprite.UpdateCoords(toX, toY, toLayer);
     }
 }