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

Get help using Construct 2

Post » Thu Jul 20, 2017 10:54 pm

Message: VulcanSpawnWolf can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
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 https://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?
B
5
S
1
Posts: 2
Reputation: 331

Post » Thu Jul 20, 2017 11:50 pm

The middle of the HUD = OriginalWindowWidth/2 , OriginalWindowHeight/2
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Fri Jul 21, 2017 12:28 am

99Instances2Go wrote: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
B
5
S
1
Posts: 2
Reputation: 331

Post » Fri Jul 21, 2017 10:15 am

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 ?
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Mon Jul 24, 2017 7:22 am

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
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
83
S
34
G
40
Posts: 3,032
Reputation: 30,474


Return to How do I....?

Who is online

Users browsing this forum: divsyntax, volumetv and 17 guests