Enemy on the edge of the screen

I have the following problem:

  1. I want a firework (sprite-based object) to pop after the edge of the screen, in the same height than the character.
  2. before the appearance of the firework, a warning (also sprite-based) must blink for the firework, and stay on the edge of the screen even if the character changes position.
  3. after the disappearing of the warning, the firework must go through the screen.

    Do anyone know how I can get the screen size in order to do this?

If you do this, the gameplay will change depending on the aspect ratio of the screen. It’s very unlikely you’d ever want to do this. You should use a fixed distance from the player instead.