How do I position the player moving in and out of layouts

Just started using Construct 2? Post your questions here

Post » Fri Jul 22, 2016 8:41 pm

Hey all. I'm creating a small scale Metroidvania type game. So each small layout is a piece of the overall map and when the player reaches the end of the layout, the game fades out and in to another layout. I'm doing this because I couldn't get camera clamping/scrolling to work on large layouts. I'm having problems placing the player in a specific part of the newly loaded layout depending on where he or she "exited" the last layout.

Hope I'm being clear. I'm trying to figure out the logic or code for this but I can't find any events that might achieve what I'm trying to do. For example, I need to position the player on the far right side of Level 2 if the player enters Level 2 from Level 3. I need to position the player on the far left side of Level 2 if they enter Level 2 by Level 1. Is there some sort of event that would give me control over the position of the player in one layout while in another layout.
B
30
S
15
G
22
Posts: 183
Reputation: 14,221

Post » Fri Jul 22, 2016 10:09 pm

Probably use a global variable to store your current LayoutName upon exiting, and on the next layout place the player's start position based on that variable.
Mistakes were made.
B
52
S
26
G
111
Posts: 1,629
Reputation: 62,679

Post » Mon Jul 25, 2016 8:27 am

@oosyrag Awesome! Just want to say thanks a lot! I got it working smoothly now. I would have never thought to use global variables to solve this problem. Guess I could use them in a lot of ways!
B
30
S
15
G
22
Posts: 183
Reputation: 14,221


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 3 guests