/// <summary> /// Determines whether any sprite is touching a wall or not /// </summary> /// <param name="item">The sprite to check</param> /// <param name="screenBorders">The edges to check against</param> /// <returns></returns> public bool IsTouchingEdge(GraphicsItem item, params ScreenBorders[] screenBorders) { bool hittingEdge = false; for (int i = 0; i < screenBorders.Length; i++) { if (((item.Left <= 0) && screenBorders[i] == ScreenBorders.Left || (item.Right >= ClientSizeGrid.Width) && screenBorders[i] == ScreenBorders.Right || (item.Top <= 0) && screenBorders[i] == ScreenBorders.Top || (item.Bottom >= ClientSizeGrid.Height) && screenBorders[i] == ScreenBorders.Bottom)) { hittingEdge = true; break; } } return(hittingEdge); }
/// <summary> /// Removes the specified sprite. /// </summary> /// <param name="item"></param> public void RemoveSprite(GraphicsItem item) { Sprites.Remove(item); }