How do I create PLAYER for layout switching?

0 favourites
  • 10 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • Hello

    I'm trying to use a sidescrolling system with different levels, on collision with a trigger, go to layout X. Now the problem is, how do I make the player appear on each layout without having to place it forehand and to actually spawn at the "logic" location acording to which side you switched layouts

    Keep in mind I do not want to have an event sheet for each layout, that would such a disorder considering I will have a lot of rooms for each level.

    I do use one master sheet where I load other sheets into.

  • Anything you want to keep between Layouts should be marked as global in the editor. as for the sides, the player will remain where it was when you switched layouts so you would have to at least create a player positioning event on layout loadings.

  • I can't really get it to work.

    I tried creating entry and exit gates, they do work within the same layout but it doesnt work when you have to switch layouts.

    Easy way would just be on Collision X with go to Layout X but then I would end with many trigger sprite and it will be a mess.

    Anyone could point me out the right path? THanks

  • Try this Capx.

    Note that i made the player sprite and the gates global objects, but you don't actually need those gates since you can achieve the same effect by comparing the X position of the player and positioning it accordingly. (When X>LayoutWidth -> Set position to Player.Width/2 + 1 || When X<0 -> Set position to LayoutWidth - Player.Width/2 - 1 || The plus and the minus is so that upon positioning you would not have the player in the area where the layout switches).

    https://dl.dropboxusercontent.com/u/213 ... ching.capx

  • It works but in my project if I do it that way I will have to do a shitload of events to make the "east" and "west" gate adding a layoutroom=X becaue I do have many rooms and can't use the previous / next layout.

    I was in the right path with the exit UID thing, the problem was I couldnt get it to work within layouts.

    Also I'm having a problem with my player being destroyed on layoutswitching. I do not have any events to destroy it outside layout. Any ideas what' causing this issue?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Maybe you have forgotten to set it to be a global object?

    About the layout switching, it would help if you post a screenshot of your game/project so i could be more specific with the help.

    If its a 4 way layout switching, like some platformers, ie, up, down, left and right, i'd say using an Array that tracks in which cell you are now and then move to the layout according to the player's position is the best way. if your game is like that and you need an example, say so and i'll provide a Capx.

    Generally speaking, if you have a multiple, varied number of rooms entrances per layout (More than 4 for each direction) you can't escape having to at least designate which gate leads to which layout.

    The easiest way i can think of is to have a family of "gates", have an instance variable for that family that's called "Layout" and manually go through each of the gates and set its instance variable to the Layout name it links to. (You will only have to do it once, and upon every new gate you create)

    Then a simple event of When overlapping "Gates" go to Layout str(Gates.Layout) will launch the linked layout. that event will be valid throughout the entire project, so long as you remember to put every gate into that family and to indicate its variable/linked layout.

    I have created an example. overlap a gate and press the up button to move to that room/layout

    https://dl.dropboxusercontent.com/u/213 ... ching.capx

    I also made it so that the player will get positioned to the doorway that leads to the layout he came from.

  • About the layout switching, it would help if you post a screenshot of your game/project so i could be more specific with the help.

    Thanks for your replies benpalgi

    Basically is a sidescrolling platformer. If you know Coin Op Story by Kamizoto from this forum, that's more likely the layout switch I'm looking for.

    Thank you

  • I watched a video of that game. haven't seen more than two exit gates for each layout, so the first Capx could actually fulfill what this game is doing, however, if there are more than two, the second Capx i shared would definitely be more than enough.

  • I watched a video of that game. haven't seen more than two exit gates for each layout, so the first Capx could actually fulfill what this game is doing, however, if there are more than two, the second Capx i shared would definitely be more than enough.

    Yeah I guess I can make your second example to work and adjust it to my proyect, thanks!

    Alltho I have a problem, how can I set up the player position to where it should be after the layout switch? Explaining:

    If I leave the layout from the right I should apprear from the left side.

  • I covered it in the reply with first example:

    "you can achieve the same effect by comparing the X position of the player and positioning it accordingly. (When X>LayoutWidth -> Set position to Player.Width/2 + 1 || When X<0 -> Set position to LayoutWidth - Player.Width/2 - 1)".

    You could also achieve that with the second example (In fact, you have far more control and options for variety with the second example), as you can see in it, there is a gate for each layout. in layout 1, there are gates for 2,3 and 4. in layout 2, there are gates for 1,3 and 4, etc.. when the player enters gate 4 in layout 1, after the switch to layout 4, the player gets positioned to gate 1, the one he came from. this way you are not restricted to the layout edges and are free to position the doors/gates wherever you please., but you could totally simply position the gates at the layout edges.

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