Moving between layouts with custom coordinates

  • Long story short, here's a graph what i mean:

    <img src="http://www.demonscroll.com/Layoutnav.jpg" border="0" />

    I didn't find this from tutorials, or from forums.

    So, the problem is, how do i get the playable character appear in different spot depending where i exit in previous layout?

    For example, if character exits in point B in Layout 2, it starts in point B in Layout 1.

    What is the easiest way to do this and do i need several event sheets for this?

    Thanks!

  • Hi Zoneboi. Maybe you could capture the sprites x and y coordinates as two separate global variables as it exits the layout. Then have the sprite spawn relative to those x & y coordinates on the next one?

    If this doesn't help I do a mock up and past it on here.

    Cheers

    H

  • This can be done with a single variable. I have a variable that I call "From" and I set its value during the transfer layout event. I have an invisible object at each exit and when you touch it, it sets the From variable, starts a fade out, then transfers you. On the start of the next layout, I have it set the player's position to different places depending on what the value is for From. I then have the map fade in.

    For instance, when going from layout 3 to layout 1:

    On overlap of transfer, set From to "Layout3" (you can also use the system expression for the current layout name)

    Go to Layout 1.

    On layout 1's start of layout,

    --> (As a subevent) If From = Layout3, set position to 340, 750

    Then just have a sub event for each possible From value on each layout's event sheet. In the case of there being multiple paths between two layouts, I just name From to Layout2a and Layout2b and vice-versa.

  • Alright!!

    HowieMonster's tip was good, but i had problems with entering in a new layout, because the coordinates were not always relative together. My graph looked like they did, so i apologize. But thanks anyway, it was good tip. Cheers! :)

    I haven't tried C-7 tip yet, but that makes perfect sense! Even though I haven't tried this yet, i'm sure it works. Thank you so much!

    If this won't work, i'll post .capx -file and hope you won't bang your heads on walls. :)

    Thank you!

    ZB

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I've made this work in my game but it's kinda hard to explain..

    First, my main character is global, so it keeps the variables when the layout changes. Then, I have 3 different variables:

    lastDoorType - checks the last door type the character has entered

    doorX - The new X position in the layour the player should appear when he moves into a new layout

    doorY - Same as above, but with Y

    Then I have 2 diferent objects (since my game is a platformer),

    doorM0passLeft and doorM0passRight.

    I have an image point called "end" on it, so I can check when the character has finished walking into the new layout.

    I'm explaining all this so I can just show you my code.

    <img src="http://i.imgur.com/vHc7U64.png" border="0" />

    <img src="http://i.imgur.com/tysBoOM.png" border="0" />

    There's probably an easier way but this is working out great for me.

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