Container sprites disappear when moved

  • The container consists of a head and face sprites eye, nose, mouth and ear. The head spawns and moves across the screen and the face sprites follow. The problem is when there are multiple heads the face sprites seem to swap between heads. Here is a simple example:

    jmp.sh/qbBgkFJ

    Can anyone explain why the face sprites are not staying with the heads they were spawned with?

  • If you use the debugger, you can see that elements of the face like nose/eyes/... are created, but are "under" the newly spawned head.

    In the event 3 and 4, you set the position of those elements, and can use "ZOrder" category actions in order to positions some elements either "Move to top", so an Eye for example will be placed on top of the "Head".

    You can also specifically use "Move to object" to clearly state you want elements like "Eye" to be placed "In front" of "Head".

    Also beware, the Head object in your project is set to be Global, I'm not sure this makes the most sense.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Many thanks Kyatric. I tried a few more things after sleeping on it, and found a solution that uses a family and instance variables instead of the container. Here are the working events if anyone is interested:

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