Beispiel #1
0
 /// <summary>
 /// Draw the entity
 /// </summary>
 /// <param name="sb">SpriteBatch for drawing</param>
 /// <param name="hardDraw">Draw no matter what</param>
 public void Draw(SpriteBatch sb, bool hardDraw = false)
 {
     for (int x = 0; x < tiles.Length; x++)
     {
         for (int y = 0; y < tiles[x].Length; y++)
         {
             if ((Level.IsWithinAllLevelBounds(GetGridPosition().X + x, GetGridPosition().Y + y) || hardDraw) && tiles[x][y] != null)
             {
                 tiles[x][y].Draw(sb);
             }
         }
     }
 }
Beispiel #2
0
        public void MoveY(int dir)
        {
            if (!CheckLevelForCollisions(0, dir))
            {
                SetGridPosition(GetGridPosition().X, GetGridPosition().Y + dir);
            }
            else if (xMoving)
            {
                xMoving = false;
                return;
            }
            else
            {
                if (!Level.IsWithinAllLevelBounds(GetGridPosition().X, GetGridPosition().Y))
                {
                    DeadOnArrival = true;
                }

                Dead = true;
                Level.AddToMap(this);
            }
        }