@th3rdsergeevich @ZySoua also, since there's only one background layer on the NES, any effects where different parts of the level scroll at different speeds are done "manually"
if these are horizontal layers that don't overlap (like, say, a background where there's mountains far away, then some hills closer by, and also you're on a train) it is relatively simple, the NES is just told to change the scroll position right before a specific line is about to be drawn (this is also how the floors in the aforementioned boss fights are drawn)
for vertical things (like in megaman 2's opening, where there's a building in the foreground and a cityscape in the background, and they move at different speeds) the building was specifically drawn in a rather simple way so that the only thing that needed to be moved around are the windows, which are sprites, and the ceiling only appears once the cityscape's fully gone, so there is still only one background layer
@th3rdsergeevich @ZySoua unlike the C64 or the sega master system, the NES does not have a "scanline counter" built-in, so tricks with separate scrolls are harder to achieve
the NES does have one trick up its sleeve, the "sprite 0 hit" flag, where if the sprite number 0 happens to overlap with a non-transparent color on the background, it pops up and from that point on you know part of that sprite's been drawn -- this is how super mario bros. tracks when the top status bar's been drawn, the sprite 0 is the coin icon's bottom part
otherwise, you either need a scanline counter as part of your cartridge's mapper chip, or to even more manually count every CPU cycle (and make sure your code always takes the same amount of time to execute) to make sure that you're changing the necessary parameters at the right time
that's downright magic, if you ask me
@ZySoua Another fun fact: most gigantic bosses in NES games are rendered on the background layer and their movement is simulated by screen scrolling, hence why the background during such boss fights is usually monochrome (usually black).