align HUD, and pop out menus in full screen mode?

Get help using Construct 2

Post » Mon Oct 24, 2011 3:34 am

Hello

I have been searching the forums, and tried everything I could think of with no luck.

Is Construct 2 capable of aligning the HUD, and or pop out menus to the right, bottom, top center, or bottom center in full screen mode on all sizes of computer screens accurately?

If so how would you go about doing this?

If not is this planned in the future, or is this something I would have to try and write a plugin for?

For example what I mean is when I align something like a health bar to the right side of my screen on a game layout size of 2000px X 2000px. It shows up where it is suppose to be. But when someone with a larger screen views the game it shows up in the middle of the screen, and a smaller screen you have to scroll to the right to see it.

I don't have a .capx because I am still coding the php scripts for the game I want to make. But here is a example picture of what I am asking?



The game in the picture above shows up the same on any screen size.

If this has already been discussed I apologize for not finding it but could you link me to it please?

Any help on this matter would be greatly appreciated.

Thank you

Wink2011-10-24 03:55:24
B
50
S
11
G
8
Posts: 479
Reputation: 9,911

Post » Mon Oct 24, 2011 4:02 am

Instead of hardcoding the coordinates, you should use the System expressions WindowWidth, WindowHeight, scrollx, and scrolly. Scrollx and scrolly give you the the x and y of the camera(so the position scrollx,scrolly is the center of the screen). WindowWidth/Height are self-explanatory.

So, if you want the right edge of the screen, you'd say scrollx+WindowWidth/2... which is,the center of the screen, plus half the width of the screen. Same for the left edge except a - instead of a +, and same principles work for the top/bottom edge as well. Using these instead of specific numbers should line up everything no matter how big the screen is.

NOTE: Of course, I could be wrong. But in my limited use of these expressions, it's work out for me just fine. Someone smarter can correct me if I'm wrong!
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Mon Oct 24, 2011 4:10 am

Actually... it seems like the new release for Construct has built-in features to handle this very thing. That's probably worth looking into.
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Mon Oct 24, 2011 4:27 am

Thank you very much SullyTheStrange. That makes complete sense to me. I was going about it all wrong again.   

There's a new release out already. And it has built-in features to handle this you say.

I don't know what I like more this incredible piece of software, The mind behind it, or the great community support.

Thanks again SullyTheStrange for your help. It is much appreciated.
B
50
S
11
G
8
Posts: 479
Reputation: 9,911

Post » Mon Oct 24, 2011 3:15 pm

Yes, the Anchor behavior (new in r64) should do this for you. If you need more advanced alignment, as @SullyTheStrange said the WindowWidth and WindowHeight expressions are the way to go.

Make sure all your UI stuff is on its own layer, and set the parallax to 0,0 or the game's scrolling will mess up the positioning of UI objects.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,498


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 31 guests