How do I attach a sprite to another in a specific way?

0 favourites
From the Asset Store
A set of 10 pixel art animated magic effects with icons. 2 Fire, 2 Earth, 2 Wind, 2 Water, Portal, Explosion.
  • 28 total instances of Sprite 2 can be attached at once. So... the shape can get pretty big lol

    The before attach is as the first Construct image, and the after is something like the second. where I'd like for it to be able to attach is given by the orange dots of the next examples here:

    Anywhere along those orange dots, I'd like for instances of Sprite 2 to be able to attach to, such that they're diagonal from one another.

    As for the instance variables, I like that idea. Will keep you posted on whether it works or not, though, for some reason, it tends to require a reset lol.

  • So those are the images of the instance shapes. However, to reject with the space button...

    ...In the order in which it's collected, the Sprite 2 instances (Colored) will be thrown in the angle from which it is collected by Sprite 1 (in Black). This is so that the shape made can match with the plans shown above.

  • I've gotten closer to what I want now but it's not 100% just yet.

    Below is an example of my code:

    And this is what's happening:

    The Sprite 2 is now just a little too close to/far from Sprite 1 anchor to make a stable shape, and the other instances sometimes overlap. Also, upon Space being pressed ALL instances have the bullet reaction instead of just the one connected.

    Still, I consider the appearance of anchors on Sprite 2 a success over not having them before.

    I think I'm missing the 0/1 variables for those, but tell me, is there something else on top of that I might also be lacking?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This was made before you posted your last few posts but maybe you can get some ideas from it.

    Roughly it just creates attachment points around all the attached objects, and then deletes invalid points that overlap other attached objects.

    It keeps track of what's attached with a boolean variable and doesn't let moving objects get attached so you can throw them. Also it keeps track of the order the objects are added with a number variable.

    dropbox.com/scl/fi/7vf4eia7vzvmnzd8hoi6g/dynamic_attaching.capx

  • This was made before you posted your last few posts but maybe you can get some ideas from it.

    Roughly it just creates attachment points around all the attached objects, and then deletes invalid points that overlap other attached objects.

    It keeps track of what's attached with a boolean variable and doesn't let moving objects get attached so you can throw them. Also it keeps track of the order the objects are added with a number variable.

    https://www.dropbox.com/scl/fi/7vf4eia7vzvmnzd8hoi6g/dynamic_attaching.capx?rlkey=gjl65ke9vjpj0nqsz42im1fq5&st=niaagaur

    Well, that's huge, to say the least. Thank you! I'll take a look into it and see what I can reverse engineer!

  • > Roughly it just creates attachment points around all the attached objects, and then deletes invalid points that overlap other attached objects.

    >

    > It keeps track of what's attached with a boolean variable and doesn't let moving objects get attached so you can throw them. Also it keeps track of the order the objects are added with a number variable.

    >

    > dropbox.com/scl/fi/7vf4eia7vzvmnzd8hoi6g/dynamic_attaching.capx

    Oh wow it's like a bubble shooter but in reverse!

  • Here's another iteration that puts the anchor points at the corners instead of the sides. It also keeps track of where anchors are in a dictionary so it avoids putting markers on attached objects and avoids duplicate markers. Still only 10 events, but I'm sure it's possible to simplify further so you have more than 15 events to use if you use the free version.

    Anyways some more ideas maybe.

    dropbox.com/scl/fi/g7fcdn16o3z7e4flss33y/dynamic_attaching2.capx

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