How do I move to another layout in same position x,y

0 favourites
  • 9 posts
From the Asset Store
This is a code so you can see the same skin on all screens (peers). Each peer gets a skin, in addition to 4 directions t
  • after a lot of failures making games, i have decided to lower down my exceptions so dumb,

    its impossible for me to fail.

    cough...apparently a few months of debugs, google search haven't even yet solve a simple yet

    important function in my new maze game, lol.

    what i want is the ability to let the player to go to a ladder,

    which teleports the player to layout 2 in the same position x, y.

    and then the player can take the ladder down to layout1.

    this is basically a very simple game that mimicks my childhood pencil and paper game,

    where the player is stuck in a maze with lots of layouts and he can move

    between layouts using ladders.

    any help is much appreciated.

  • Put an invisible sprite with its origin point-0 where you want the origin point-0 for your character on each layout level and simply have it spawn the character at its 0 origin when layout level loaded. You will need a different one for each level so just name them ladder1-2, ladder2-3, etc. If he can return up the ladder then put ladder2-1, etc on other end...

    Why are you using layouts and not layers you set to visible/invisible?

  • Here done try it

  • thanks a lot Lordshiva1948 and for helping a nub like me.

    Lordshiva1948, you have made it that the player can move in between layouts but i need it that the player is at the position that i determined which is the about the same x, y position.

    or to make it easier to understand: i will have 5 staircases in each layout, so the player needs to climb the staircase

    upwards directly to another layout in same x, y position and not like going to any x, y position in another layout.

    chrisinfinger, i didn't know you can do it by layers, layers sounds like something i can do but i want try to solve it by layout due to the intense curiosity i have garnered by trying to fix it by layout for such a long time.

    the capx this time i added in persistent to the player and a second staircase.

    can you guys or someone else shows me how you make it that the player can actually move to another layout in the same position x,y or near staircase for both staircases.

  • Is this how you wanted it?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • A quick and dirty way that should work, would be to have two global variables

    let's call them:

    PlayerPosX and PlayerPosY

    every tick set PlayerPosX to Player.x and set PlayerPosY to player.y

    On start of layout - Player set position x:PlayerPosX y:PlayerposY

    This is ofcourse not a neat and tidy way to do it and all other suggestions are actually better than this one, but just thought I'd mention it..

  • Or you could use Instance variables to go to spacial ladder of your choice

  • There are multiple ways to do it but the essence of them boils down to... something has to tell the next layout where you want it to place/spawn the player instance when it arrives.

    Another possible way would be have a new global layout type shared with all layouts that only stores the entry and exit locations... but I haven't fooled with global layouts so don't know if this would work.

  • thank you very much to Xavier, LittleStain, Lordshiva1948, !

    now i dun need to go back to pencil and paper game making, LOL XD

    im now using xavier's method which is similar to what i have been trying to attempt all along,

    the problem why my method doesn't works is because i keeps on trying to set position the player to an object

    on the next layout which maybe haven't yet loaded completely which then causes a lot of bugs to confuse me.

    xavier's method sets the position of the player to the object/co-ordinates to the current layout

    and not the next layout.

    LittleStain's method works and uses very little events as my game will have lots of layouts

    but have some flashes( player teleporting in between layouts continuously.)

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