How do I do a Metroidvania-like Transition through layouts?

0 favourites
  • 9 posts
From the Asset Store
10 Loopable Tracks, and 34 SFX. Perfect for Metroidvania, Platformer, Adventure games.
  • So I have a game with a player and everything. But let's say I want to go to a different layout with the same player object.

    The "persist" example shows a way to do it:

    if player.x < 0 then
    [ul]
    	[li]system: go to layout 2[/li]
    	[li]player: set x to layoutwidth-30[/code:2jh7czai][/li]
    [/ul]
    But I try the exactly same thing but it just doesn't work. I even used the debugger on both projects but nothing. 
    
    Any ideas?
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You would be better off making all the rooms just connected and making large sections in layouts rather than a layout for each room because Construct 2 is setup for "stage" style games. More like the older Castlevanias (1-3) rather than ones like Symphony of the Night.

    There is a good thread of someone doing this with some success but I can't remember what it was called. I would search the fourms for Castlevania, metroidvania, or mega man to try and find some info.

  • You got to do it on one layout. You also need an arrays that will store you rooms, so you can remove their graphics from the layout if they are not the room you are currently in. When player goes in to a door, you disable all controls, and you just got to teleport everything in opposing direction to where player is going,, moving everything by the width of the room you're leaving. Once he is in the new room, you remove the old room, and enable back the controls.

  • Hm, I don't know, this doesn't seem that great, to keep removing and recreating everything... Specially for a mobile game.

  • Hm, I don't know, this doesn't seem that great, to keep removing and recreating everything... Specially for a mobile game.

    Well, you didn't say it is for a mobile game. Regardless, it's even more important on mobile to have minimum instances running on the layout. Other way would be not to move the rooms, but you'd need large layout.

  • What if I stick to a lot of layouts but keep saving the player's variables each time I leave and enter a room?

    Also, how does it work like I said up there in the Persist example?

    EDIT: I didn't mean to say that my game is for a mobile game, I'm just trying to find a general solution...

  • What if I stick to a lot of layouts but keep saving the player's variables each time I leave and enter a room?

    Also, how does it work like I said up there in the Persist example?

    EDIT: I didn't mean to say that my game is for a mobile game, I'm just trying to find a general solution...

    Thing is, there is almost never one general solution . It all depends on how you want the game to behave. I never used persist object, but from what I did read, it is only to keep object's variables across layouts and not position. You could eventually create 2 instance variables ( or global variables ) PlayerX,PlayerY, and then on starting new layout, set it's position to new X but load Y from the variable ( if you moving horizontally ). Ah, and you'll need to store information which room your player is exiting, so you can determine which direction player is entering from to set his starting position accordingly. Best thing would be to use arrays, and create some layout naming convention that you could easily loop trough and compare with data in array.

  • Yeah, that's close to what I thought

    Thanks for the help!

  • Make you player global cheers

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