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

Get help using Construct 2

Post » Wed Apr 16, 2014 9:59 pm

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:

Code: Select all
if player.x < 0 then
- system: go to layout 2
- player: set x to layoutwidth-30


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?
B
53
S
11
G
6
Posts: 133
Reputation: 8,830

Post » Wed Apr 16, 2014 11:26 pm

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.
B
8
S
1
Posts: 76
Reputation: 949

Post » Wed Apr 16, 2014 11:40 pm

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.
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
89
S
30
G
22
Posts: 1,985
Reputation: 20,099

Post » Thu Apr 17, 2014 12:32 am

Hm, I don't know, this doesn't seem that great, to keep removing and recreating everything... Specially for a mobile game.
B
53
S
11
G
6
Posts: 133
Reputation: 8,830

Post » Thu Apr 17, 2014 1:02 am

siks wrote: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.
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
89
S
30
G
22
Posts: 1,985
Reputation: 20,099

Post » Thu Apr 17, 2014 1:08 am

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...
B
53
S
11
G
6
Posts: 133
Reputation: 8,830

Post » Thu Apr 17, 2014 9:31 am

siks wrote: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.
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
89
S
30
G
22
Posts: 1,985
Reputation: 20,099

Post » Thu Apr 17, 2014 3:00 pm

Yeah, that's close to what I thought ;)
Thanks for the help!
B
53
S
11
G
6
Posts: 133
Reputation: 8,830

Post » Thu Nov 06, 2014 3:50 pm

Make you player global :) cheers
B
13
S
4
G
1
Posts: 7
Reputation: 973


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 37 guests