How do I solve my scaling issue?

Get help using Construct 2

Post » Thu Mar 13, 2014 5:54 pm

Hi,

I’ve been searching the forum and attempting to resolve an issue I have for a couple of days now with no joy.

I have a dilemma regarding Window/Layout size and scaling. I’m a total newbie and hopefully I’m being an idiot and there’s an easy solution.

Basically, I want my game to look professional on iPad to iPhone 5. I have an object which reacts with the edge of the screen. To achieve this I’ve used a sprite placed off the edge of the layout for the object to collide with.

However, if I use aspect ratio whereby the layout size is greater than the window size the edge sprite on different screen ratios will not be placed in the correct position (screen edge) for the object to collide with. I want the object to be able to move off the top of the screen but react with the edges.

Please can anyone help or provide some insight?


Much appreciated.
B
5
S
2
Posts: 10
Reputation: 495

Post » Thu Mar 13, 2014 6:02 pm

A better way to achieve this would be to check the objects coordinates.


If objects X<=object.width the object is on the left side

If objects X>=layout width - object.width // the object is on the right side

If objects Y>=object.height // the object is on the top side

If objects Y>=layout height - object.height // the object is on the bottom side
Last edited by Alyra Games on Thu Mar 13, 2014 6:10 pm, edited 2 times in total.
B
10
S
2
Posts: 135
Reputation: 1,090

Post » Thu Mar 13, 2014 6:06 pm

Thanks for the reply.

I haven't checked but aren't the co-ordinates based on screen size anyway? So I would have the same issue as the coordinates on 16:9 ratio would differ from 4:3?
B
5
S
2
Posts: 10
Reputation: 495

Post » Thu Mar 13, 2014 6:08 pm

You have to use the viewport. But I don't exactly now how to do this. Or maybe the window width/height operators.
Last edited by Alyra Games on Thu Mar 13, 2014 6:11 pm, edited 1 time in total.
B
10
S
2
Posts: 135
Reputation: 1,090

Post » Thu Mar 13, 2014 6:11 pm

Thanks I'll look into this I'm just hoping someone can tell me a way so that when using aspect ratio and the sides are cropped on 4:3 the object can recognise the edge of the screen.
B
5
S
2
Posts: 10
Reputation: 495

Post » Thu Mar 13, 2014 6:13 pm

I searched for viewport an found this: https://www.scirra.com/manual/28/layer

layer.viewLeft
layer.viewRight
layer.viewTop
layer.viewBottom

This are the commands. So I assume instead of layout width it would be layer.viewRight .
B
10
S
2
Posts: 135
Reputation: 1,090

Post » Thu Mar 13, 2014 6:17 pm

Thanks again. However, do you know if there is a screen/window command? As for 4:3 I don't believe you would see the full layout and this may not work. I will try this though. Thanks

I won't get a chance to test this until tomorrow but I'll post again as soon as I've tested it. Many Thanks.
B
5
S
2
Posts: 10
Reputation: 495

Post » Thu Mar 13, 2014 6:40 pm

This would be window.width.
B
10
S
2
Posts: 135
Reputation: 1,090

Post » Fri Mar 14, 2014 12:19 am

Hi just to let you know I've managed to sort it using:

ViewportLeft(layer)
ViewportRight(layer)

Thanks for your help.
B
5
S
2
Posts: 10
Reputation: 495

Post » Fri Mar 14, 2014 12:30 am

No problem. Good to know, thanks.
B
10
S
2
Posts: 135
Reputation: 1,090


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests