Since the enemy was above him at the moment of the collision, but because of the weak power of the Dandy microprocessor, the SMB developers decided to save resources by simplifying the calculations to the limit acceptable by the player’s mind. As long as man does not question the adequacy of physics, his subconscious will quietly draw the missing fragments.
But in reality, the process of crushing enemies is implemented according to one simple rule: if Super Mario is in a fall when crossing a player with an enemy object (the vector of vertical acceleration is directed downwards), it is automatically assumed that Super Mario jumped on top of the enemy.
Crush the enemy with a mustache
The Y coordinates are not compared since objects are moving discretely, that is, in one frame Super Mario could fall on the enemy from above and fly below his center, so that at the moment of registration of his intersection Y turned out to be below Y of the enemy.
And since after crushing the enemy, Super Mario jumps up from him, the inattentive viewer does not even notice how the rise phase of the jump Super Mario entered the fall phase just before the collision, and then the rise phase began again.
And finally, a million question – how does Super Mario go through walls? The calculation of collisions with the background in SMB is implemented quite standardly for Super Mario Bros NES Rom – the intersection with an impassable block is determined after the fact, after which the pushing force turns on, which corrects the coordinates of the hero so quickly that without slowing down, Super Mario’s foot fell into the brick for a split second. However, having an inhuman reaction, this force can be deceived. Popping usually occurs in the opposite direction to the player. This is logical – if a player runs to the right and collides with a stone block, he should be pushed to the left. But if you tricky, you can immediately send Super Mario to the left after activating the pushing force, having changed the direction of movement for those tenths of a second while the character is still partially inside the block.
For the full passage through the block (16×16 pixels), such a focus is not enough. The retractor will soon be compensated by pressing the back button, and Super Mario will exit the block. But here another feature of the physical calculations of the SMB comes to the rescue – in the jump the direction of movement does not change. Try it yourself to make a big jump to the right and turn around on the fly, holding Left. Nothing will come out! Changing the button will register, but Super Mario will continue to move forward until he falls to the ground. This is not Chip & Dale, where you could change the direction of the jump in the air. Here inertia leaves its mark on the course of game events. By the way, the more realistic SMB physics may be the main reason for the popularity of the game.
Using gravity for a quick exit
So, so that when you press Back, Super Mario would still move forward, and at the same time, the pushing force would only help him in this, it is required to be in a state of descent after a jump with beating bricks over his head. The easiest way is to penetrate the wall in a situation where Super Mario hits a brick ceiling in front of the wall itself, as in the illustration to the right. Here, the author needed to make several micro-jumps, during the descent phase of each of which the object penetrated the wall deeper and finally reached full immersion.
If there is no ceiling in front of the wall (or it is too high), then penetration is still possible, but this requires tremendous patience and many re-recordings of unsuccessful jumps. The key factor is a certain speed of vertical and horizontal displacement, allowing even before landing on the lower boundary of the block to get into it more than half. Then, during the subsequent jump, Super Mario will be able to knock down the upper block in the same way as was done in the case of the ceiling in front of the wall.
Painting all this is difficult… Even if you now understand everything said, for a complete analysis of the process of penetration into the wall it is necessary to look at the pressed button combinations in frame-by-frame mode.