How do I Set Position to Opposite Side

0 favourites
  • 3 posts
From the Asset Store
Build your own spaceship for your side scroller space shooter games with various components.
  • 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.

  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thank you so much! This is exactly what I was looking for!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)