One of the biggest mechanics in a platformer like Super Mario Bros is being able to interact with objects around the map. How was this done? It was done by using the players vertical screen position on the horizontal map position to determine collision with the objects on the screen.
in between each frame the game will check if the player's position has intersected with a list of objects in the screen and run the function related to the object. For example if the player ran into a pipe it would not allow you to move in that direction anymore or if it hit a brick from underneath it would do animation and bounce the player back down etc..
interactions with objects
Creating physics
Aug 2017 — forever