How do I rotate objects but keep them between 2 angles

0 favourites
  • 5 posts
From the Asset Store
Simple resize and rotate events for any sprite, quick and easy event sheet that you can use for your own projects.
  • Hello

    I am working on a side scrolling shooter and i would like the spine, torso, neck and head to all rotate towards the mouse.

    Easy enough right but, i want each obeject to have it own rotation boundrys so the player doesn't brake his back and do wierd stuff if you catch my drift.

    i cannot figure this out, so i tried the easy way and make alot of sprites connected them to the players boundry box so the mouse has to be within a certain sprite for the body part to rotate, but it isnt the best, im sure there is and easier more officiant way.

    here is the construct file with love and hope :0.

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

    thankyou <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • For each of the sprite (spine, torso, neck) etc, have an event that checks its current angle in relation to the body part sprite that its connected to.

    It's a case of if, else logic.

    ie.

    If Neck.Angle > Spine.Angle + 45 => Set Neck.Angle to Spine.Angle + 45.

    Thus, the Neck can never rotate more than 45 degrees in relation to the spine. It will snap to 45 degrees relative to the spine whenever you go beyond. Do to the same for the Spine.Angle -45 or whichever way in reverse and it will work.

    Hope that helps!

  • Sorry i have been away for a while.

    Thankyou very much it worked perfectly <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">.

    I have one more problem though, i have pinned all the body parts together but the forearm likes to lag behind, even though nothing else does and they are all set up exactly the same.

    i dunno why :/.

    here is the file if you need to have a look thankyou <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">.

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

  • I definitely think its has something to do with layer parallax, but I couldn't figure out what. Also there is a better way to do camera let me know if you want to know

  • yeah sure all tips are welcome buddy .

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