How do I transfer non-global pinned sprites from one layout to the next--can I use a global layer?

  • Hello;

    Suppose I want to transfer two pinned sprites and their current instance variable values to another layout. If I have a global Hud layer that both layouts share I can stick them on the Hud (out of sight perhaps) leave the first layout and then transfer to the new layout and copy the pinned sprites off the hud onto a layer in the second layout. (all while the game is running, I am not talking about doing this in the editor).

    This won't upset the UID count or anything, bringing in UIDs from another layout since they are all unique anyway? This should work shouldn't it? So I don't need a bunch of global sprites? SInce the UID didn't change they should stay pinned?

    thanks for your time

    yours

    winkr7

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No, this won't work, the objects themselves need to be set as global.

    Alternatively, just re-create them on start of another layout. You can do this:

    unpin them, save their states (Object.AsJSON) in a pair of string variables. On start of layout create two new objects, load their states from JSON, pin.

    (You need to unpin/pin, because PinnedUID in JSON string will not match the UID of newly created object)

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