Can I Keep Settings Throughtout Every Layout?

Get help using Construct 2

Post » Sun Jun 23, 2013 12:23 am

Whatsup everyone,

Im here again with a few questions regarding layers/layouts.
I had some help from @GeometriX yesterday and i really thought i had most of this down but i am afraid i am still in need of some info.
I know that i can set Objects to Global to keep them from being destroyed while switching layouts,Is it possible to keep things in the current STATE while switching layouts aswell? What i mean is i have A Day and Night system that i would like to carry over to the next layout,For example i have a Forest biome,if its night time in my forest biome and i want to go to my jungle biome how could i make it where it stays night time while switching layouts?

-Second Question-
Whats the best way to transfer my player from layout to layout?
I have tried doing the global thing on him from properties and it doesnt work,Im not sure if that works with the player object just the same as everything else since i do have a player mask that he is bound to.

-Third Question-
If i would rather buld every layout from scratch instead of making it an instance would it cause lag becuase i hand built the terrain?My room right now is 3200x3200 and i was aiming for something bigger since i am creating a sandbox game,I dont know much about arrays because i havnt found the right tutorial/Learning Process for me.Thanks everyoneRookieDev2013-06-23 00:32:07
GMO FOOD = DEATH
B
23
S
9
G
5
Posts: 567
Reputation: 6,368

Post » Sun Jun 23, 2013 12:56 am

I'm perhaps not the best person to answer your questions in-depth, but in regards to question 2;

One way would be to keep all your player stats as instance variables for your player, but also store each variable as a global variable in an event sheet (global variables are accessible across all event sheets). Just before you move to the next layout, set all of your global player stats to your player's current instance variables.

Then, on the start of the new layout, you spawn your player object, then set your player's instance variables to the values you saved in the global variables after exiting the previous layout.Nullus2013-06-23 00:58:39
B
3
Posts: 23
Reputation: 221

Post » Sun Jun 23, 2013 12:59 am

1) Use global variables, a variable "Day" that you set to 1 if it's day and 0 if it's night. You can have a whole bunch of variables, put them on a different event sheet if you want.

2) If the object it global it will keep it's instance variable values and appear at the position it had in the previous layout, make sure you specify in every layout where the player is supposed to spawn.

3) I recommend you read the blog articles and tutorials by Ashley on optimisation and performance.Nimtrix2013-06-23 00:59:58
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Sun Jun 23, 2013 1:13 am

@Nimtrix @Nullus

Thank you guys,I got alot out of what both of you said,I wont take anything from @GeometriX aswell,He also gave me great information about the subject.Thanks again guys you have helped me alot.
GMO FOOD = DEATH
B
23
S
9
G
5
Posts: 567
Reputation: 6,368

Post » Sun Jun 23, 2013 11:55 am

@Nimtrix @ Nullus @RookieDev   I cant seem to get my player to go from layout to layout. I have a Mask and a player sprite like rookie does what do i have to do? Do i need to add another event besides making it global? And does the behavior follow the object when switching layouts if its global?,

I have global on both my player and mask
I added an event to make them both spawn on the start of the layout
I am going bald with every second :p pulling out hair. Lol thanks guys if anyone can help me please
B
9
S
5
Posts: 126
Reputation: 1,295

Post » Sun Jun 23, 2013 12:16 pm

@TheNewGuy Im not sure,Im actually still testing around with things myself.I have been asking around the forums quite a bit here as of late.But to anwser your question,Im having issues with my player and mask.I was starting to think i was the only ONE.sorry i couldnt help man maybe @geometriX or someone else can though.
GMO FOOD = DEATH
B
23
S
9
G
5
Posts: 567
Reputation: 6,368

Post » Sun Jun 23, 2013 1:34 pm

Awwww man I really want to have my player switch between layouts but when i switch it shows my player in the sky but my mask falls to the ground. I have them on Global and they wont stay pinned together when switching.
B
9
S
5
Posts: 126
Reputation: 1,295

Post » Sun Jun 23, 2013 1:50 pm

[QUOTE=TheNewGuy] Awwww man I really want to have my player switch between layouts but when i switch it shows my player in the sky but my mask falls to the ground. I have them on Global and they wont stay pinned together when switching. [/QUOTE]

Behaviours should remain if the player object is global. Events, though, are Event Sheet dependent. If you're handling player events in one layout, then moving to another layout without those events, then they won't apply.

Remember that "Pin to object" is a behaviour, so if your new layout doesn't have that behaviour, you'll lose the pin.

It may be a good idea to have all of your main player events on a single event sheet, then "include" that event sheet in the event sheet for every level. That way you don't have to re-write your player events, and can use them on every layout.

Or you could just copy the Pin event across each event sheet that you need the Pin behaviour for.Nullus2013-06-23 13:52:42
B
3
Posts: 23
Reputation: 221

Post » Sun Jun 23, 2013 1:58 pm

@Nullus The INCLUDE FIXED IT!! I had include in the wrong place! Thank you thank you thank you Nullus!
B
9
S
5
Posts: 126
Reputation: 1,295

Post » Sun Jun 23, 2013 3:10 pm

[QUOTE=TheNewGuy] @Nullus The INCLUDE FIXED IT!! I had include in the wrong place! Thank you thank you thank you Nullus! [/QUOTE]

Don't mention it. Sometimes you just need a fresh perspective to make you spot the problem. I don't know how many times I've completely overlooked something simple that I didn't even consider could be the problem.
B
3
Posts: 23
Reputation: 221

Next

Return to How do I....?

Who is online

Users browsing this forum: Exabot [Bot], gatostao, hielo777, keeno79, smlyldz and 8 guests