Flagpoles, or Flags, are an entity used to easily end levels. It creates a trigger from nine blocks above and everything below it. Everything else is an invisible wall.
As soon as the player grabs on, they will slide down the pole, taking the flag with them. Once the flag hits the bottom, the player will start walking to the left for 6 blocks or until they hit a solid object, where the player disappears. Then, the remaining time in the level is drained and added to the player's score.
After that animation is complete, the will load a new level. The level it loads is decided by incrementing the current level by one, unless it is the fourth in the world, where it will go back to one and instead increment the world number instead. Unlike an Axe, a Flagpole will try and load worlds above 8, whereas an Axe will trigger the final cutscene. Any other levels must be reached via Warp Pipes or Animations.
How to Use EditIn its simplest form, a Flagpole is really just an invisible trigger to end levels. Any other details, including the castle and pole itself, are simply tiles. Ideally, the entity itself should be place inside a tile, and a pole or similar structure should extend at least 9 block above that.
In 1.6 and below, the game would only consider the X coordinate of the entity, and they would always be created at a constant Y value. Flagpoles would always be at the same height as they would be in Super Mario Brothers.