Get help using Construct 2

Post » Wed Mar 06, 2013 6:20 pm

I'm confused about ViewPort. I hadn't noticed this until recently when I added a start-screen to my game. The stuff doesn't appear where it should appear. For example, if I put an object at 0,0, it just appears near the middle of the screen, which is wrong.

Somehow I seem to have not noticed this in 4 months of programming. My main screen is using WindowWidth and WindowHeight to calculate positions, and I'm using Crop-mode and scaling everything myself. It works fine, and 0,0 on my main screen corresponds to the top-left.

ViewPort on the start screen just looks totally wrong, it has strange coordinates like the top left is at -448,-89.5. And if I get the centre of the screen with VPL+VPR/2 it gives 512. Since my screen window is 1920 pixels wide, I don't see how 512 is the centre of the screen (although if I put something there, it DOES appear in the centre, I just don't understand why).

I'm not sure if this is important. My main screen works fine with my scaling and coordinates, on several browsers. I guess I could just work out what's happening with the start screen and use Viewport coordinates.

* I am seeing partly what's happening. The left coordinate is -448 and the right coordinate is 1472. If you add 1472 and 448 you do get 1920, which is the correct width of the screen. I guess what's confusing is, why is my main screen working with 'normal' coordinates and the new screen isn't.

* What makes this really confusing is, on my main screen, I position everything around the player ship (the ship stays in the centre and everything moves according to your position). That probably solves most problems automatically, but what I don't understand is, why can I place the ship at WindowWidth/2, WindowHeight/2 and it DOES appear in the centre. But when I do the same on the other screen, it doesn't? Apparently the VP coords are the same on both layouts.

* After a bit of dabbling I think I understand why the two layouts are working differently. My player ship has the 'scroll to' behaviour, meaning everything centres around it (I think). Apparently the whole layout behaves differently when one object has that behaviour. I made some text with the 'scroll to' behaviour on the start screen, and now the whole screen works with 'normal' coordinates (i.e 0,0 is the top-left now).farflamex2013-03-06 18:59:26
Posts: 456
Reputation: 5,853

Return to How do I....?

Who is online

Users browsing this forum: dop2000 and 25 guests