is there a way to detect when one actor successfully faces another?

RocketBrainRocketBrain Member, PRO Posts: 269
edited November -1 in Working with GS (Mac)
Theres gotta be a way to do it. just cant figure it out.

Comments

  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    As in face to face type face each other?

    You could do several rules which determine what image. therefor what direction they are facing and then determine if one is right or left of the other with the correct image to facing the other.
    WOW I hope that makes sense.

    It sure did I my head when I wrote it :)
  • RocketBrainRocketBrain Member, PRO Posts: 269
    wha? key example of what i want

    actor one facing down.

    touch screen somewhere

    actor turns to face that position

    i need to know when it sucessfully faces so i can make it do other stuff.
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    yep you most likely have to do it based on images like tenrdrmer said.

    Since you cant actuall flip the actor you can detect which way its facing like that, so depending on which way there facing. So if one has a image looking right on the left of the screen and one on the right of the screen is looking left image, then youll know there facing each outher.
  • RocketBrainRocketBrain Member, PRO Posts: 269
    the rotation is going to be slow so i need it to detect when it finishes
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    well you can determine what the rotation is when there facing which way. so if one with a rotation of 180 and one with another rotation of 180 are facing each other. Then you can just make global attributes for the 2 then constrain the attributes to there self rotation. So when actor1rotation= 180 and actor 2 rotation= 180 with all conditions valid, you should be able to put your rules in there and will only happen when there facing each other.
  • RocketBrainRocketBrain Member, PRO Posts: 269
    thats only for two actors facing each other? i need it to detect when its successfully turned to face the touch position
  • AjBlueAjBlue Member Posts: 215
    all you have to do is make a game attribute real call actor.rotation. then you want to make your actor to perform a vector to angle expression, vectortoangle(self.position.x,self.position.y)-(mouse.position.x,mouse.position.y). i may be wrong with that expression just search it if it doesn't work. then you want to make a constrain actor.rotation to (put vectortoangle formula). now all you have to do is make your actor rotate to the touch position. and perform a rule saying if your actors rotation = actor.rotation atribute : perform what you want

    hopefully it helps...
Sign In or Register to comment.