How do I pin an object to a specific image point?

0 favourites
  • 8 posts
From the Asset Store
Connect the dots in the correct order and draw happy animals!
  • Hi,

    I have a player animation with diffrent imagepoints for its hair, glasses and so on.

    On creation I spawn the objects (hair, glasses and so on) at the corresponding image point and then I pin it to the playeranimation.

    However the player animation, well is an animation and the image points are on diffrent positions at each frame.

    So my question is, is it possible to pin an object to the image point? So if the image points moves while playing the animation, so that the pinned objects follow the image point?

    Ashley is this even possible with the Pin behavior?

    Edit: Found out that rexrainbow already made such a behavior, thanks man!

    Thank you!

  • There is a behaviour called pin+ which have a ton of pin options and pin to image point is one of them. Just select which image point and it will pin it correctly wherever that image point is on the object during an animation.

    I use this behaviour for all my games now and is one of my most used plugins.

    You can also pin animation, mirror, scale, opacity and best of all. You can automatically destroy the pinned object if the object it is pinned to is destroyed which makes the original pin behaviour useless in comparison Highly recommended

  • AndreasR

    if I remember correctly the Pin behavior is the same as Every Thick set position, so wouldn't be easier to do?

    Every Thick: object1 >>Set position to (base_object) image point 1

    like this doesn't matter where you place the image point in different animations as long that animation has the image point will be placed on the correct spot

  • AndreasR

    if I remember correctly the Pin behavior is the same as Every Thick set position, so wouldn't be easier to do?

    Every Thick: object1 >>Set position to (base_object) image point 1

    like this doesn't matter where you place the image point in different animations as long that animation has the image point will be placed on the correct spot

    Hi,

    I actually did that before. However when the player moves fast, the pinned object laggs after it.

    But it also happens with rexrainbow behavoir PinToImagePoint.

    I'll try the Pin+ behavior, maybe this works.

    Or has anybody an idea how to prevent the pinned object from lagging behind?

    My player object hast the platform behavior. And when it starts moving, the pinned objects are lagging behind...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There is a behaviour called pin+ which have a ton of pin options and pin to image point is one of them. Just select which image point and it will pin it correctly wherever that image point is on the object during an animation.

    I use this behaviour for all my games now and is one of my most used plugins.

    You can also pin animation, mirror, scale, opacity and best of all. You can automatically destroy the pinned object if the object it is pinned to is destroyed which makes the original pin behaviour useless in comparison Highly recommended

    Hi,

    thanks for that hint, I'll try out this one

    Thank you!

  • Ok I figured something out.

    I have a rectangle sprite as player (for collision box). This object has the platform behavior.

    To this object I have pinned the player animation (another sprite object). This object is not lagging behind.

    So to the player animation I have pinned the accessories, like glasses, hair and so on to its corressponding image point.

    This objects are lagging behind, because the aren't pinned to the actually moving object.

    If I pin them to the player object having the platform behavior, those objects also stop lagging behind.

    Any ideas why this is happening?

    Edit: Made an example

    https://www.dropbox.com/s/sgp3iaustgamk ... .capx?dl=1

  • AndreasR

    I think what happens is that your "Player is on screen" event is triggered first on start of the tick, before the Pin behavior does its job.

    You set position of Hair to the PlayerAnimation sprite that hasn't moved yet. After that Pin behavior adjusts PlayerAnimation position to Player sprite, and the Hair stays behind (lags).

    If instead of pinning PlayerAnimation to Player, you do "PlayerAnimation Set position to Player" (the same as you do with hair), then there is no lag.

    You should use either Pin behaviors, or "Set position" actions, not the combination of both.

  • AndreasR

    I think what happens is that your "Player is on screen" event is triggered first on start of the tick, before the Pin behavior does its job.

    You set position of Hair to the PlayerAnimation sprite that hasn't moved yet. After that Pin behavior adjusts PlayerAnimation position to Player sprite, and the Hair stays behind (lags).

    If instead of pinning PlayerAnimation to Player, you do "PlayerAnimation Set position to Player" (the same as you do with hair), then there is no lag.

    You should use either Pin behaviors, or "Set position" actions, not the combination of both.

    Hi dop2000

    I got it working now. I set the position of the player animation to the player every tick, but I pin the accessories to the player animation.

    Now it doesn't lag afterwards!

    Thanks for the hints!

    Regards

    Andy

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