How do I swap layouts properly

0 favourites
  • 5 posts
From the Asset Store
Full game Construct 2 capx code source to post on Google Play
  • 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.

  • 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.

  • Ok thanks! Ill look into it

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • do you want the old swords to be there when you go back?

  • 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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)