Multiple Global objects, but only 1 at a time crosses into another layout.

  • Sorry if this is in the forum somewhere. I can't seem to find an answer.

    I have several main characters that can be controlled. Several of them are comprised of more than 1 object

    (like a tank and a turret). Its important for the non controlled characters to stay where they are so I'm applying "persistent" to them.

    To make it so they can move to another layout I'm applying "Global" to them.

    So... is there a relatively simple way to make it so only the character who is "active" (and their "accessory" go to the next layout, and have the rest of the playable characters stay put?

    -a few complicated solutions...

    1. Make secondary "characters" for all the playable characters that are place holders and not "global" and when using one it destroys and spawns the actual Global character.

    2. Mark all playable characters upon exit from layout and destroy them in the next layout.

    3. Only make things "persistent", and not global. Then manually copy, destroy, and respawn whichever character is being used when changing layout including all variables.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's too difficult to imagine from the description, I can't really tell what your game is about. It sounds like it's a game where you leave players behind in a dungeon and return to them or something, which I guess persist is ok for, but I can't be sure that's what you're doing. You also only mentioned in a vague way what information is being carried between layouts so it's difficult to tell why it is such a problem. If the game is how I'm imagining it then you won't need to use global as you are travelling between layouts and always return to the other characters. 3 sounds like the better option plus wouldn't you have to 'respawn' a global character anyway based on co-ords assuming that you walk through a door and appear at a door at another location?

  • If you don't understand the question you could ask questions to clarify. Otherwise you're just throwing out guesses at answers to possible questions. No offense intended. I just don't know how to respond to what you said in another way.

    There are several main characters and you can only use 1 at a time. All others who aren't being used at the time have to stay put. Its a game where there's a human who builds and gets in vehicles to drive around and do things in the game. The vehicles can be modified and there are a bunch of variables that change with each vehicle, and there can be multiple examples of the same Vehicle model.

    Anyway, I solved this by making the human player Global and all the vehicles persistent.

    If Human player is "active" it just works with the global characteristic.

    If a vehicle is active there is no human in the layout. When vehicle gets to edge of layout the vehicle spawns the global human on its position and layer then fills in a bunch of variable the global human has to record type of vehicle, HP, what accessories are one it, etc. Global human crosses into next layout and if he's not set as "active" he spawns all the stuff in his variables, pins what needs to be pinned, destroys self, and a split second later it looks like the robot just walked across layouts while all non used robots stay put.

  • Oh, and when I say the non active vehicles need to stay put... I mean they can be left anywhere on any layout in the game that they can get to.

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