Rotation limit

0 favourites
  • 12 posts
  • Hi,

    i found some threads about limiting rotation angle but i still cant solve it.

    My character's arm is rotating towards the mouse but i need to set certain angle range so it wont go backwards. I realize the 0 degree starts horizontally.

    Anyone can provide me some example files or ways?


  • anyone has solutions???

  • I'm just curious here. How did you make your arm? A sprite pinned to your character?

  • Okay so I looked at it quickly

    Please take a look at this capx, and see if it's what you need:

    I tried a couple ideas but this one is so simple it can hardly fail.

  • Holy mono.. i didn't think of using mouse.x as a restriction. Thanks!

    Btw for the arm, it is a separated arm sprite that i pinned to the player box and setting a image point to the player box's arm.

  • You're welcome! You should also be able to mirror it if your user wants to walk the other way ;)

  • I have problems with mirroring it. When i set it to mirror, the rotation only works when the mouse.x is bigger.

    I set another event where mouse.x is smaller but it has some weird results..

  • If you send me a capx I'll have a look at it?

    EDIT Made the changes to my own capx. Would this help you?

  • I realized what's the problem after looking at your file. I set mirrored to my arm sprite which gives it the weird rotation. And then i need to add the 'flip' so that the arm is not upside down when i go left.

    Thanks Hoyer!

    Btw, when the mouse is too close to the arm sprite, the 'set angle towards' is not working. Any ways to get past that?

  • iikii,

    My first guess would be your origin is in the middle of the sprite instead of on one end, am I right?

  • Basically what LittleStain said. Also remember if you have a problem, posting a capx makes it much easier for other people to address the issue. I'm glad I've been of help, good luck with your game <img src="smileys/smiley20.gif" border="0" align="middle" />

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • yea thanks for the help :)

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