How do I Set Position to Opposite Side

Get help using Construct 2

Post » Thu Feb 09, 2017 5:49 pm

I'm trying to make a layout where when you reach one side you're seamlessly taken to opposite side. I'm trying to make the illusion of infinite space, not like asteroid where you leave the layout, I'm aware of the layout wrap option. I want it so a player could keep flying in a direction and they'll loop back without being aware of it.

So far I've tried making a invisible sprite that when you touch it it sends you to the opposite side, but I can't figure out the right expression to do that. Right now it's set to Sprite3.x-(Sprite.X) Sprite3.Y-(Sprite.Y), I feel I'm somewhat close with this but it's not working the way I want it to.
B
7
S
1
Posts: 10
Reputation: 445

Post » Thu Feb 09, 2017 8:43 pm

@dansilveira

Here's a quick example capx (r233)

Basically, I scroll to the player ship (has Car behaviour for movement), turn Unbounded Scrolling to Yes and when the ship reaches the edge of the layout I adjust the ship position by adding or subtracting the layout width or height as appropriate.

You'll need to make the outside of the layout match the opposite inside edge, which I do using a Tiled Background.

EDIT: Updated drop box link
Last edited by OddConfection on Tue Apr 25, 2017 7:25 am, edited 1 time in total.
Vote for all the Construct 2 games on Steam Greenlight - Find them here
B
33
S
9
G
7
Posts: 450
Reputation: 6,778

Post » Thu Feb 09, 2017 9:01 pm

Thank you so much! This is exactly what I was looking for!
B
7
S
1
Posts: 10
Reputation: 445


Return to How do I....?

Who is online

Users browsing this forum: Laura_D and 22 guests