I ran into a problem while working on my platform game (once again :D) and i couldn't really found solution for it.. so here is the code:
Blocks.AddRange(this.Controls.OfType<PictureBox>());
if (Blocks.Any(x => x.Location.Y - Player.Height <= Player.Location.Y))
{
Player.Top = Height - ClosestBlock.Location.Y - Player.Height;
}
and I need to detect which Block is the closest to move player on. If you have any ideas please let me know, Thanks!