Constrain, ahhhhh

joey2ejoey2e Member Posts: 99
edited November -1 in Working with GS (Mac)
Hey all

Right am stuck, although I suspect I am just being a little slow!!!

I have an actor we will call X for the time being.

I want X to rotate according to where I touch the screen, however I don't want him to rotate past a certain point, i,e I want the actor to only rotate between 0 degrees and 60 degrees, also asides from rotating I dont want the actor to move at all.

I have tried lots of different variations and just cant seem to get it to work.

Any suggestions would be well appreciated :)

Comments

  • scitunesscitunes Member, Sous Chef Posts: 4,047
    create an angle attribute game.AngleToTouch (or something)

    constrain self.AngleToTouch to VectorToAngle(gam.Touch1X-self.positionX,game.Touch1Y-self.positionY)

    Constrain self.rotation to max(0 ,min(60 , self.AngleToTouch ))
Sign In or Register to comment.