Return to Layout issues

Get help using Construct 2

Post » Fri Jun 07, 2013 7:28 pm

Currently in my layout I have the Camera lerping with the character based on what zone he is in. This is creating a problem however.

I want the character to be able to enter a house, but if I use the "set position" event to move him to another part of the layout for the houses interior the camera then scrolls to that area, which I do not want.

So, I decided to make the house interior on its own layout, and simply have it so when the Character hits the house door it sends him to the House interior layout.

But, when he leaves and comes back to the layout, the character then goes back to the original start position of the original layout.

My brain is fried, does anyone have any ideas to either get rid of the scrolling camera issue, or set the position of the character to outside of the house when he returns to the original layout?
B
4
Posts: 78
Reputation: 606

Post » Fri Jun 07, 2013 8:26 pm

Use dictionaries they are layout independent and can store variables throughout your project. Let your brain rest a bit

note that the trigger has 3 image points because why use more triggers when you can use more image points xD.

Small capx example made for you @Hexxiss mrPeanut2013-06-07 20:28:03
B
9
S
3
G
3
Posts: 70
Reputation: 1,990

Post » Fri Jun 07, 2013 11:17 pm

cooooool I always thought the dictionary was just for spelling check in word games
B
40
S
11
G
7
Posts: 514
Reputation: 9,636

Post » Fri Jun 07, 2013 11:47 pm

Dictionary is for saving pairs of "key" -> "value" for whatever you want.
Lead developer at Octeto Studios

Visit our portfolio at: http://www.octetostudios.com/ :)

Facebook || Twitter || Youtube
B
37
S
7
G
5
Posts: 217
Reputation: 5,614

Post » Sat Jun 08, 2013 3:34 am

Instead of lerping to character, use the scroll to behavior. This will eliminate the scrolling while changing layout position issue.

As for saving the character's position, create two globals

playerX
playerY

At end of layout, set playerX to player.X and set playerY to player.Y. When character reenters layout, set position to playerX, playerY

good luck
B
11
S
3
G
2
Posts: 26
Reputation: 3,124

Post » Sat Jun 08, 2013 8:26 pm

Thank you all, especially MrPeanut for taking the time to help answer all those questions! I love the community on here, you're always a great help!

And great suggestion Pappapuck, on the globials! I may have to give that a try also. I tweaked what Mr Peanut suggested, and it seems to be working great for now!
B
4
Posts: 78
Reputation: 606


Return to How do I....?

Who is online

Users browsing this forum: Darth Crusher and 2 guests