How do I 'Wrap' in an area within layout window...

Get help using Construct 2

Post » Wed Jul 06, 2016 6:12 pm

Asteroids is the game. The layout is 1280, 720. The window is 960, 540. Due to having the controls on the left/right sides of the window, i need the sprites to wrap in a 704, 540 size area within the layout window so they do not get obscured by the controls.

I've been banging my head to figure this out but all i'm getting is headaches.



Any help would be greatly appreciated and welcomed. And my sore head will be thankful, also.
B
38
S
18
G
19
Posts: 664
Reputation: 14,107

Post » Wed Jul 06, 2016 7:16 pm

IIRC the Wrap behavior can only do layout or viewport and nothing else, soooo... might be that the only workaround is to simulate it through events. Just do something like "If object X position > 704 --> Set object X position to 0" and then adjust the exact positioning so it looks smooth.

Having the Wrap behavior bound to viewport should take care of the Y coordinates for you, although you can technically do the exact same thing for Y.
B
51
S
24
G
18
Posts: 293
Reputation: 13,061

Post » Wed Jul 06, 2016 7:29 pm

Talk about throwing a monkey wrench...

So how to wrap the sprites so the controls do not cover them?

Is it possible to have a invisible sprite - 704, 540 and when the sprites are not touching that sprite to wrap?

Dang, gonna have to work on this.
B
38
S
18
G
19
Posts: 664
Reputation: 14,107

Post » Wed Jul 06, 2016 10:52 pm

I mean I suppose you could have sprites on either side of the screen, behind the controls, which are used to test the X position of objects.

Basically, let's say your window is 960 x 540, so you can give your objects Wrap behavior and set it to "viewport". Now they will wrap around the 960 x 540 area instead of the entire layout. Now we add the controls that cover up the left and right sides, so our window is 704 x 540. Let's say it's dead center, so we add two objects, Right Boundary and Left Boundary on either side where the controls are.

Now set conditions like this,

If object's X position is < X position of Right Boundary --> Set object's X position to X of Left Boundary
If object's X position is > X position of Left Boundary --> Set object's X position to X of Right Boundary

This means that when object crosses the Right Boundary, it will get teleported to the Left Boundary and vice versa. Basically it just does what the Wrap behavior does, but with custom borders.
B
51
S
24
G
18
Posts: 293
Reputation: 13,061


Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], Yahoo [Bot], yiuyiu6666 and 14 guests