Bottom of Window HUD Scaling Issues

Get help using Construct 2

Post » Thu Feb 09, 2012 8:34 pm

So I'm having some trouble with making a HUD for my game. I'm trying to go for a retro look, so I'm creating my sprites at tiny sizes and then setting the game to Fullscreen Scale mode and point sampling, while also having my window size set at 320x240. This works pretty swell for everything except putting the HUD at the bottom of the screen.

As the window's height grows larger, the HUD elements on the bottom of the screen go further and further down off the screen. They don't want to stay on. I've got my HUD layer set to Parallax 0, 0, and I've tried giving both of the HUD objects the Anchor behavior, and I also have it programmed to set the object positions to "window height - hud obj height", but to no avail. Putting the layer's Scale to 0 keeps the HUD onscreen, but obviously doesn't scale it along with the rest of the game and so does me no good.

Another thing I've noticed is that everything is lined up perfectly as long as the height is at the default 240 height and greater than the default 320 width, but any smaller and the positioning and scaling get thrown way off. Setting the browser into fullscreen mode changes nothing.

Any HUD elements in the top left of the screen with the Anchor behavior seem to work fine for whatever reason, as evidenced by the text displaying the current window height in the following capx.

I don't know if this is a bug or not, but it's certainly cramping my style, especially since the HUD would look real awkward on the top of the screen.

Problem Capx!
http://dl.dropbox.com/u/20459682/hud_trouble.capx
B
58
S
20
G
7
Posts: 305
Reputation: 8,804

Post » Sun Feb 12, 2012 9:18 pm

I can't open your capx because I don't have all those plugins installed, but try to use 320 and 240 instead of WindowWidth and WindowHeight.
B
79
S
24
G
54
Posts: 4,751
Reputation: 40,765

Post » Mon Feb 13, 2012 5:06 am

No dice! I actually tried that before. What it does instead of going down off screen, it goes UP off screen. How bizarre.
B
58
S
20
G
7
Posts: 305
Reputation: 8,804

Post » Mon Feb 13, 2012 11:24 pm

When using Fullscreen(scaled) I don't find the WindowWidth and WindowHeight expressions enough to position objects to the edge of a 0,0 parallax layer.

The solution is to use the Anchor behavior. But since your events indicate you don't want to have to recreate the HUD per layout make the hud objects global and position them on your startup layout. Then they just need to be moved to the HUD layer per layout with events.
http://dl.dropbox.com/u/5426011/fixed/fix_for_tl22.capx
B
79
S
24
G
54
Posts: 4,751
Reputation: 40,765

Post » Tue Feb 14, 2012 1:22 am

Well that works brilliantly for the HUD! Thanks so much!

BAM! http://dl.dropbox.com/u/20459682/hud_solved.capx

Unfortunately this means I have to figure out how to streamline my message windows again. Not a huge huge deal, but if the Anchor object had some way of changing the anchor positions midgame it'd be infinitely easier. But that's for another thread methinks.

Thanks again so much R0J0!
B
58
S
20
G
7
Posts: 305
Reputation: 8,804


Return to How do I....?

Who is online

Users browsing this forum: GSquadron and 26 guests