scope of copied objects on diff. layouts

0 favourites
  • 4 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • I have a game which was created on portrait. I then copied the layout (and all its layers and objects), named it landscape, and resized and re-arranged some of the items.

    How does construct 2 reference copies of the same object on the same layout, and on different layouts?

    Is there any way to reference the object on the current layout (e.g.

    craete object CurrentLayout.SpriteA
    

    Otherwise, how will you know which of the two objects of the same name it will pick?

    In game, the player can switch between portrait and landscape any time (e.g. by resizing browser, or turning phone/ipad).

    I have one event sheet attached to both layouts.

    It mostly works, but there are some strange effects.

    Sprite A and Sprite B were on layout1, and were copied to Layout2.

    In the event sheet, I create new sprite A object, and place it on the layout. If I resize Sprite A in layout 1 before hand, the new size is not reflected when playing in either layout1 (portrait) nor layout2 (landscape) - its in limbo.

    However, when I resixe Sprite A copy in layout 2, the new size shows up when playing in both portrait and landscape mode. This is odd.

    However, if I resize sprite B, which was sitting on the layout (not created dynamically) 1, it only affects layout one, and the same for layout 2.

    Other strange effects are that I have a version, status and FPS text field which are all updated by the single event sheet each tick. However, only two of the three text fields work - I cant get the version to work any more. Even though I am updating it, its not getting updated in either layout.

  • Each layout is independant, when you switch layout the only thing that c2 keeps is global variables and objects, everything else is destroyed when you leave a layout. New instances are created when you enter the other layout.

    The event sheet just uses the object there's on each layout as if there was only one layout.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • hmm. That sounds logical, but layout 1 defilietly is creating objects from layout 2. e.g. If I have spriteA on layout 1 and the same object copy on layout2, then radically change the size of spriteA on layout1 to be huge, and the spriteA copy on layout2 to be tiny, when the object gets created on layout1 its using the tiny version from layout2. Layout2 uses the tiny version too.

  • Maybe it's using the default size of the texture.

    To be sure share the capx

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