Picking two different objects simultaneously

0 favourites
  • 4 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • CAPX: https://www.dropbox.com/s/75kl0jf3h80sxq6/XDGAniLogoV3.capx

    In the set-up for an animated logo that will be set before the game (just like the big boys do it), I'm attempting to arrange instance of an object so that they can "distribute" themselves to their final position after being created.

    To try to give a succinct overview of what I have so far...

    1. On start of layout, establish values of object instances (see capx).

    2. GROUP: Grid Pieces: Place LogoGridPiece instances at a distance to be Lerp-ed back in to a tic-tac-toe arrangement. The center instance will Lerp its opacity to 100 at the same rate the other 8 instances are moved back into place.

    3. GROUP: Randomize Trigrid Draw pieces: The instances of the LogoTrigridPiecesDraw object are manually placed on the layout in an ordered manner (covering two layers which will come into play later on when I write in the events), they will eventually form the letters "XDG" (remove the "XDGLettersOutline" layer and you'll see what I mean). I don't want the letters to be obvious initially. So every instance of the object here is randomized - positions swapped all the way through.

    4. GROUP: Trigrid Piece Placement: And this is where things get to be problematic. I've assigned every instance of the solid black LogoTrigridPiece object a number from 0 to 5 for one of the six instances of the LogoGridColorFlash object. The PLAN is to move the instances to one of the Flash object (underneath it). Then, each instance from one of the six positions on the board will Lerp to its original spawn location (represented by the HomeX and HomeY instance variables). The problem I am having is getting the instance variables, DisplaceX and DisplaceY to be set to the X and Y values of the Flash instance objects. The Displace variables are the other end of the Lerp distance to be traveled. So what ends up happening is that ALL the LogoTrigridPieces get thrust to the far left side of the window and slowly Lerp together...like cool looking ninja stars, which are fine, but not the goal.

    No matter how I try, I cannot get it to select one instance of the LogoTrigridPieces AND the correct Flash instance to store its X and Y coordinates into the DisplaceX/Y instance variables. For each iteration of the For Each event loop, I want to advance the WhichGrid instance variable to select the correct instance of the Flash object. And THAT much works...but the X/Y values never get stored to the Displace instance variables because it won't let me ALSO pick another instance of another object at the same time during the loop. Again, I've tried several different methods.

    Thanks for your time and support!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm not sure what you are trying to achieve, but would a something like for each sprite, pick logogridplace with the same instance variable work?

  • You are a victim for the old "can't create an object and pick it until the next top event" issue. Your LogoTrigridPiece objects can't be picked in event 15. This is a known artifact of C2's architecture. You just need to make a second "On start layout" immediately after the first and move event 15 under it. I still don't think it is doing what you want, but this will get you closer.

  • LittleStain & blackhornet - Thank you, both, for your feedback. I think I've got a workaround that will take a few extra events - I'll just have to "manually" reference the exact coordinates I want each instance to be at. Thanks again for trying!

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