Pin and set position issues

0 favourites
  • 11 posts
From the Asset Store
Wall Pin Board is a hyper causal game developed for fun and inspired by YouTube video whose link is given in description
  • Hello All

    ------------------------------------------------------------------------

    Basically I want to simulate separate body parts moving dynamically with each other, either with a pin or with a set position action. In this case, an arm that aims toward the mouse input (already scripted), and also have the shoulder bob up and down with a separate walking animation (my trouble).

    ------------------------------------------------------------------------

    I have a character in game whose walk/run/death animation is completely separated from his arm. I have it set up this way to give the arm the flexibility to revolve 360 degrees around the shoulder pivot.

    I have a problem, and I'm not sure if it is my fault of Construct's. At first the arm was pinned to the shoulder image point, and it followed the player flawlessly.

    However, my player seemed very stiff when walking/animating, so I added a more dynamic walking animation, and set the image point of the shoulder to change every frame, moving up and down as the player walks.

    I thought this would work, but the arm now lags way too far behind the player.

    To fix it by setting the position of the arm to move forward depending on the player's speed:

    (Arm_Pos.X+2*(Player.Platform.Speed/28), Arm_Pos.Y)

    ...Which keeps the arm in place, but now it is extremely shaky.

    So, I'm at a loss. I have also scoured the forums to no avail. If anyone has successfully done something similar, help would be thoroughly appreciated.

  • Are you using pin or set position now?

    system every tick: set arm: shoulder.imagepointX(1), shoulder.imagepointy(1)

    This should work.

    The lagging could come from the shoulder changing position in the eventsheet after the arm is set into position. The order of events could be your issue.

  • Have you looked at the plugin Spriter? Although I have never had need to play with it, it sounds like it was designed to do exactly what you are looking for.

    A capx would also be useful to see what you is actually happening.

    If I remember, behaviours (pinning) are frame rate independant, and you are most likely setting the image point per tick, making it frame dependant. Not sure if that could cause the lag, but I am starting to get out of my depth here.

  • Thanks for the quick responses. I would upload the .capx, but its fairly big (200mb+)

    Here is a link to the game, if you want to see my player layout. Just go to Arcade Mode.

    dl.dropboxusercontent.com/u/211250504/NoctisHorroremV0.64/index.html

    LittleStain In this version I have it on pin, but I hate how stiff the animations look. So, I'm trying to make this more dynamic. My work file now has it set to the position of the shoulder, thus lag. It could possibly be my event sheet...

    AngelEyes I actually do use spriter, and its great. However, I need to move the arm independently from the player animation. Which, may...? be possible with spriter?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think the problem is you are trying to pin your arm every tick, but that's not what the pin behaviour is meant for.

    once you pin a sprite it will move relatively to the sprite it's pinned to. Resetting the position of the pin every tick makes the pin behaviour kinda useless.

  • I'm not pinning every tick; I never did that. Sorry If I was unclear.

    I am setting an X and Y position every tick, but that's when the arm starts to lag behind the body.

    Edit: Also I'm not using pin with set position. I only have it set to set position now.

  • The arm is pinned and you are trying to set it's position at the same time?

    That means every tick the arm is told to be at two different positions

    1 - the position the pin behaviour demands.

    2 - the position you tell it to be.

    That wont really work.

  • Yeah, I figured that out after trying it. Lol.

    Pin + set arm angle worked fine, but it was too stiff for my taste. So I trashed pin for now.

    Now I'm doing set position + set arm angle, and it would do exactly what I want except that it lags.

  • Check if the order of your events is right.

    The position of the arm depends on the position of the shoulder, so the shoulder must be set in the correct position first in your event sheet, the angle of the arm depends on it's position so position of the arm must be set before the angle.

    so the order should be:

    • make sure the shoulder is in it's final position for that tick
    • make sure the arm is in it's final position for that tick
    • set arm angle.

    If this is all correct and lagging still occurs, seeing how your events are set up might give an answer.

  • So I made a sample file with a player and an arm that is set to the player every tick and also follows the mouse.

    dl.dropboxusercontent.com/u/211250504/setPos_setAngleEXAMPLE.capx

    There is literally only one event and it works great; no lag. It would appear that my massive event sheet is the culprit. I'll have to re-arrange some stuff.

  • So I got around to trying to fix this today. I figured out what was the issue, although I'm not sure why it's an issue.

    I have an invisible player sprite, and all the body parts are pinned to it, besides the shooting arm. The shooting arm's position was set to an image point on the walking animation, which was pinned to the player sprite.

    I set the position of the arm to the player sprite, and no lag. However, if I set the position on anything pinned to the player sprite, I get lag.

    So from what I've been testing, the location of the scripting doesn't matter. You just can't set something's position to something that is pinned.

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