How do I swap layouts properly

Get help using Construct 2

Post » Thu Apr 06, 2017 7:10 pm

Hello!

I have a player that can pickup/hold a sword and shield which are separate objects. The player object has global set to 'yes' and can move between layouts.

The problem is if I have multiple sword objects on a layout and set global to 'yes', all sword objects move to the next layout instead of just the single instance the player is holding.

I want the ability to carry objects through multiple layouts without all instances moving across.
B
11
S
2
G
1
Posts: 7
Reputation: 1,091

Post » Fri Apr 07, 2017 3:51 am

make a database or an array and save what your player has, then load it OnStart of Layout.

In my game I use RexRainbow's CSV plugin and save everything to a "database", then load it when I go to a new layout.

No need to keep anything global, unless the sword itself has sprite-specific data --like if your swords broke after a certain amount of usage like in Minecraft, then you need to store that data across layouts, and most likely there could be many many swords.. but even then I'd use some sort of database.
B
98
S
32
G
16
Posts: 1,204
Reputation: 16,715

Post » Fri Apr 07, 2017 10:10 am

Ok thanks! Ill look into it :D
B
11
S
2
G
1
Posts: 7
Reputation: 1,091

Post » Fri Apr 07, 2017 3:17 pm

do you want the old swords to be there when you go back?
B
98
S
32
G
16
Posts: 1,204
Reputation: 16,715

Post » Fri Apr 07, 2017 6:15 pm

I may add durability in the future, at the moment just getting them to carry through is fine. I downloaded the rex stuff, so just need to look into it now :D
B
11
S
2
G
1
Posts: 7
Reputation: 1,091


Return to How do I....?

Who is online

Users browsing this forum: 25games, Ashley, mcscooter, TRMG and 21 guests