Multiple resolutions - solid example

Get help using Construct 2

Post » Thu Nov 15, 2012 12:26 pm

ugh, it's gone... can someone send me the file so I can put it back online?
B
107
S
40
G
10
Posts: 456
Reputation: 13,202

Post » Fri Nov 30, 2012 12:48 am

Here you go gammabeam

Multiple resolutions - solid example.capx

I knew I had it some place in my disorganized 365GB's of files. lol
B
50
S
11
G
8
Posts: 479
Reputation: 9,911

Post » Wed Dec 12, 2012 12:57 am

I reopen this topic asking @gammabeam or others for help.

Taking your example how can I programmaticaly put an element on the bottom of the screen consistently across different ratios?

Take this example:

I want an element to be exactly his height from the bottom of screen (origin center), x is irrelevant:

At the beginning I was doing this:

(WindowHeight / scaleRatio) - (sprite.Height/2)

Which worked on the normal ratio but started doing strange things with different ratios, it became apparent that that H would change with the ratio, so I did a proportion:

(WindowHeight / scaleRatio) - ( ((sprite.Height* (WindowHeight / scaleRatio))/LayoutHeight) / 2 )

But doesn't work, why?

Here is a modified capx showcasing my problem: capx, how can I make the "start" button stick in the same position (bottom of screen - self.Height) across different resolutions?

Thanks for any help0plus12012-12-12 00:58:23
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Wed Dec 12, 2012 9:46 am

Anyone?
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Wed Dec 12, 2012 10:00 am

I'm not sure about the math, bust at a glance, use viewportbottom instead. Windowheight grabs the height of the whole window, rather than just the windows's content.Arima2012-12-12 10:01:00
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Thu Dec 13, 2012 12:15 am

@Arima
@Ashley

I may have stumbled onto a bug?
After banging my head onto a wall I discovered that for some strange reason viewportbottom/top change value during execution, it looks like it needs to stabilize..
If you execute it "on start" it returns a value, if you execute it "every tick" it gives a different value (the first is the same as onload) all the subsequent are the correct ones.

Why?
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Thu Dec 13, 2012 12:25 am

Ahh, that might explain the weird behavior I've been having with my ui. At a guess, it might have something to do with the canvas being resized to full screen at start and so returning a value from before the resize? Not sure exactly...

I've been getting around it by running the ui placement code for a few ticks before deactivating the group.Arima2012-12-13 00:27:19
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Thu Dec 13, 2012 12:42 am

I ended up creating two global variables that gets populated with viewportBottom/top after an event on the main menu, because I needed it at the very beginning of the "game" layout.
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Thu Dec 13, 2012 9:12 pm

Oh duh, yeah, that's a better idea. :)
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Thu Jan 03, 2013 10:40 pm

Help me, do not know what resolution is best for my all generation iphones and ipads. Should i draw a different size images and to load them depending on what phone&ipad do i use?, and how to do it? or draw is always high resolution and scale it up?
B
4
Posts: 8
Reputation: 816

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, anty21ro, PavleNikolic and 24 guests