Keep an object attached to another

0 favourites
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • I know about the pin behavior, but I'd like to keep objects (like guns or shields) attached to a character's hand which moves as he animates. Oddly enough, simply using "Set position to object" every tick will make the gun/shield lag behind the character. Why is this, and how can I keep it attached?

  • When you set position to object, does every frame have the same image point on your hand? Double check that for if you every tick set the gun to image point 1 see if image point 1 is on every hand for all your animations.

    -edit-

    Just reread your post, if you are using every frame try changing it to every tick

  • It is every tick. Slight typo in my first post.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I hate to do this, but... bump?

    I still can't for the life of me figure out why setting an object's position to another every tick would make it lag behind the other.

  • I had this trouble in MMF.. I haven't attempted anything like this in construct.. However, if there's a pin-to type function, you could use that and alter the actionspots and hotspots in your animation... Again, I have no actual experience, just trying to give you an idea on how to proceed.

  • Pin-to-type? Would this somehow be different from the existing Pin?

  • I'm having this problem for my shadow of colossus based game too. The sword is always lag behind the character when the character move with fast speed/ falling/ jumping.

    It will be great if someone can figure out how to deal with this problem.

  • System Every Tick (your sword sprite) set position to (your Player Sprite Image Point 1) You need to create a new point on your player sprite . I did that for a helper and it's constantly attached to my character even when moving quite fast so that should probably work. Cheers

  • Also the events are read from top to bottom, so make sure that first the player is placed, then the gun if possible

  • : That's what I'm doing.

    Aphrodite: The player is placed by pinning him to a separate object that handles his platforming, so his position is not controlled by my 'code'.

  • Does the player's pin to the PlayerMovement apply after the weapon's manual move to the player? What's the order in which events and behaviors are acted on?

  • I hate to do it but....

    Bump.

    Don't tell me you guys never tried to keep an object attached to another before?

  • tublood, ofcourse we have and we have never had many issues with it..

    If you could share your capx or at least your events we might see where things go faulty..

    The two most common mistakes are:

    • pinning every tick instead of once with a triggered event..
    • setting the position of object1 to a position relative to object2 before chanching the position of object2 in the same tick

    if these don't apply helping without having a look at your events is almost impossible..

  • Thanks for your advice

    And here is the video

    youtu.be/N44vn5ZZIdE

    Object 1: Red square called HitDetect.

    Object 2: Black rectangle called PlayerBound, at the very back of the character, using platform behavior

    Object 1 set to Player Sprite's hitbox1 image point ( current at the origin )

    Player Sprite pinned to PlayerBound ( position and angle ) at the start of the layout ( 1 time pin only )

    Object 1 lags behind while object 2 is moving ( u can see in the video )

    In the Code i set

    Every tick

    --------- Hitdetect set position to PlayerSprite ( image point "hitbox1" )

  • I'm having the same issue. :l

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