public void draw_inventory(SpriteBatch s, Display d, Actor a) { d.draw_metal_box(s, new Rectangle(display_loc.X - 10, display_loc.Y - 10, 324, 274)); for (int i = 0; i < items.Count; i++) { items[i].draw_cubby(s, d, false); } Point on_screen_loc = new Point(Microsoft.Xna.Framework.Input.Mouse.GetState().X, Microsoft.Xna.Framework.Input.Mouse.GetState().Y); int hover_id = -1; Rectangle temp = new Rectangle(); for (int i = 0; i < items.Count; i++) { temp = new Rectangle(display_loc.X + ((i % (25 / 5)) * 50), display_loc.Y + (i / (25 / 5) * 50), 50, 50); if (temp.Contains(on_screen_loc)) { hover_id = i; } } if (hover_id != -1 && !items[hover_id].is_empty) { items[hover_id].draw_info(on_screen_loc, s, d, a); } }