How do I Make Something Appear On The Middle of the Screen

  • I really didn't know how to title this, but I'll explain.... I'm doing a top-down shooter (based of the simple beginner's tutorial one) and I've inserted the Konami Code so that you'll get 2x your max health (That's all I really can do with it for now) but when enter the code (up up down down left right left right a b s) I want a simple easter egg sprite to pop up in the middle of your screen and fade out. I've tried spawning it in the middle of here gyazo.com/1dafaa37fd5053387fd7b1cb136c7bbd (You can't see it because it's outside the layout and I spawn it in when the code is entered) and having it spawn on the layer "HUD" which has a parallax of 0, but it spawns there, and fades out, but not on the screen (You only see it if you're in that image, I want it to appear on the middle of your screen no matter where you are) any ideas?

  • The middle of the HUD = OriginalWindowWidth/2 , OriginalWindowHeight/2

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The middle of the HUD = OriginalWindowWidth/2 , OriginalWindowHeight/2

    You didn't get what I meant, I want it in the middle of your visible screen, not the entire game screen. So no matter where you are it's in the middle of your visible screen, not the entire layout

  • What is the difference between 'your visible screen' and 'the entire game screen' in context to a non HUD layer with (as you stated) Parallax property's on zero ?

  • I think he wants to place it so if the screen or aspect ratio can scale to outer/inner - that it will still be central.

    You can try using:

    Set x -> (ViewportLeft("layer")-ViewportRight("layer"))/2

    Set y -> (ViewportBottom("layer")-ViewportTop("layer"))/2

    Just replace "layer" with the name or number of your HUD layer...

    ~Sol

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)