Pin to Image Point?

0 favourites
From the Asset Store
Connect the dots in the correct order and draw happy animals!
  • Animmaniac

    It might use "else" to replace "condition: Var = 1".

  • I think you are right, I was confusing it with the else trick.

    I got intrigued by how to optimally solve it when the on and off conditions are not the perfect inverse of one another. For instance, just when picking the civilian it must be overlapping the player, but to release it not.

    Something like:

    +On S pressed

    -+Var = off

    -+is overlapping player -> set var to on

    -+Var = on -> set var to off

    In my example I couldn't solve it without complicating too much so I left both the on and off conditions depending on the overlapping just to make things simpler to understand, although it was not the ideal.

    Any ideas of how to solve this beautifully?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Animmaniac That is really cool. I like how the Civilian box kind of shifts to the position. I really need to look into "lerp". It looks like it can be used for easing things into place which would give a more organic look to some of the things that I'm doing.

    However, with the way I'm working, I need the lifted object to constantly be stuck to an exact spot on the animation. For instance, If I animate someone bending down and picking up a box, I need the box to stick to the character's hand the in each frame of animation.

    That's why I went with creating an invisible sprite that updates to the image point through the entire game and then pinning to that sprite using chrisbrobs method.

    Here's the capx:

  • I found a more elegant solution for triggering the events and updated my example:


    sman118 If you want to stick it to the image point just remove the lerp. You don't need to create extra objects for it.

    I don't know exactly how your game is supposed to work, but if your character can hold only one civilian at a time I recommend picking by storing the civilian UID like I did. This avoids possible annoying bugs that may appear as your project grows, since there's absolutely no way to pick more than one object this way.

  • Animmaniac That works great. I'll have to study up on UID's as I'm still pretty new and that is a bit out of my wheelhouse.

    The reason that sticking to those image points are so important is because I'm going to have situations where the animation and movement is going to change whether you are holding an object or a person.

    If you're lifting an object, the animation will have them bending over, picking it up, and carrying it above their head. I need to be able to have the object follow an image point on the animation so it lines up.

    More importantly, when you are carrying a civilian I am going to have a stock set of animation for the torso, legs, and cape. Then I'm going to use the image point to overlay the player's head, arms, and whichever person they are holding.

    <img src="" border="0" />

  • What worked for me was in the event sheet I did...

    System > Every tick > Set position of sprite to,

    X: Sprite.ImagePointX(ImagePointYouWantToUse)

    Y: Sprite.ImagePointY(ImagePointYouWantToUse)

    Then I adjusted the image points accordingly, it's a little sketchy but it works.

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