How do I keep the same image object between layouts

0 favourites
  • 5 posts
From the Asset Store
112 High-Quality destruction sounds for videogames
  • How do I keep the same image object in the same place between two layouts ?

    I have an image which is located in layout 1 in some position(x,y), when the game goes to another

    screen, which is layout 2, I want the same image to be on the same spot regardless of other objects in

    the second layout.

    Is there a way to do it by an event on layout 1 so it will affect also layout 2, without using the same

    event to position the image also in the events sheet for layout 2 ?

    For example, like a life bar you see between different screens/levels in a game.

  • Hi Zoltar!

    Just grab the xpos and ypos while you're in layout 1 and store them in global variables.

    Then go to layout 2 and get those variables and use them to position your object there.

  • Is there a way to do it by global array since I have some images, and instead of using multiple global variables I would like to create a global array if it's possible ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Have you considered NOT using a different layout, but instead just using the visibility of the layers in a single layout? The visual effect would be the the same as a new layout and all of your objects would already be in the right positions.

  • Yes, I thought about it, the question is if it's the right thing to do and what someone does when we're speaking about

    different levels in a game and in each screen you have to keep track of the same images in the same position ?

    In my game I have a menu bar with 5 different weapons inside 5 cells, after 2 minutes the game switches to another screen which is the weapons store, so the player can buy/sell his inventory to the store. after clicking on "Done" button the screen switches back to the game with the updated weapons in the same 5 cells which are located in the same spot all the time during game play.

    So if for example the player has used all the units of weapon in cell3 than the image of this weapon disappears and cell3 becomes empty which I want to be reflected also in the weapons store where the player can see his inventory like in the game screen.

    I thought about using only layers in the same layout, but is it the right thing to do ?

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