How do I create objects within viewport width

Get help using Construct 2

Post » Fri Oct 21, 2016 2:03 am

The main objects in my game are 90 x 90 pixels and have the bullet behavior. They travel at an angle of 90 and 180. Testing my game over lan using letterbox scale everything seemed fine, but with scale outer they are too far away from the edge of the viewport on the X axis.

I tried following some demo examples but now they are created too far outside the viewport on some phones, tablets.

How can i make sure they are always created within the viewport width?

Would it stay constant across different phones?


Thanks for any input and help.
B
38
S
18
G
19
Posts: 664
Reputation: 14,107

Post » Fri Oct 21, 2016 5:33 pm

Still stumped on how to create these objects so they are only created just outside the viewport on the Y axis, but within the dimensions of the X axis.

Example: Layout is 576 X 896, window is 320 X 640. Objects should be created at : X random (45, 275) Y -90

On scale outer the window shows more of the layout, and the objects are created around 100 pixels inside the edgeof the window.
B
38
S
18
G
19
Posts: 664
Reputation: 14,107

Post » Fri Oct 21, 2016 10:18 pm

First you have to centre the layout. After that things are pretty easy.

https://www.dropbox.com/s/e743o85fw15id ... .capx?dl=0
B
33
S
18
G
27
Posts: 2,440
Reputation: 20,344

Post » Fri Oct 21, 2016 10:19 pm

Sample by @puntodamar
Support Multiple Screen Size: https://www.dropbox.com/s/hjvxbtroe1g8d ... .capx?dl=0
Might give you the idea.
ImageImage
B
101
S
45
G
22
Posts: 772
Reputation: 21,468


Return to How do I....?

Who is online

Users browsing this forum: Cubus32, tarek2 and 7 guests