Mario Bros. : The Original Arcade Classic

Hello,
I was wondering how the collision is done in
Mario Bros. : The Original Arcade Classic

look at the:

if you are not familiar with the old game…
when the player hit a bloc it goes up and the connected ones go up

how can this be done?

Thanks

some ideas:

Thank you i will explore those options