Pin to Image point don't combine with a sin?

  • I have a character that has an attached head pinned to a body that has a image point(1) at top of the body.

    The body has a sin (height), the image point (0) of the body is at the bottom, the image point (1) is at the top of the body, when you apply a height sin to the body the image height go up and down, only not the image point(1) and that's the problem.

    I can't find any solution to keep his head on place when it jumps or fall down, at fast systems it's acceptable, but at slow systems his head comes of way to far.

    I have try:

    • pin (won't work) but should be the only way to get it work if the image point was updated according the sin I gave it.
    • Always put head at position body.ImagePointX(1),body.ImagePointY(1) works to slow, head comes still of.

    Do I miss something or is this not possible?

    Thanks in advance

  • Can you provide a capx.

    but as a heads up.

    A pinned object can't be moved until un pinned.

    You can't apply sin to the IP. just the objects

  • Have a look in this thread. This might be the solution you're looking for, I hope.

  • Steely

    Yeah, the pin behavior will not reflect changes in the parent's height/width. Fortunately, it's fairly easy to roll your own generic pin system using Controller + ConnectedSprite by using families.

    I'm not sure what you're seeing without a capx, but here's a simple example manually re-positioning the head without seeing the popping-off behavior. And as a last resort, you can always turn your bug into a feature by repurposing your game into rockem-sockem robots.

    Here's a demo:

    https://dl.dropboxusercontent.com/u/12667027/ImagePoint%20Attachment%20Test/index.html

    Here's the capx:

    https://dl.dropboxusercontent.com/u/12667027/ImagePoint%20Attachment%20Test/ImagePoint%20Attachment%20%28not%20pinned%29.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks every one,

    Ok here a example capx

    Because it won't work with pin behavior I made a simple example exact how it's made in my game, it works perfect here, because there is only 1 line of code.

    The game is a side scroller/runner game.

    Biggest problem is when its running at a phone or tablet, then his head comes a quarter inch of.

  • This capx you've uploaded has this problem and/or your sidescroller game? We still need more details. Are you talking about native browser (safari/chrome) on tablet/phone, or wrapped like CocoonJS or PhoneGap?

    Just tested this capx on my iPad 4th Gen using web preview without any problems. Could be a speed issue.

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