Tuff to answer: Getting Actor B to move towards Actor A

GingerBGamesGingerBGames Member Posts: 390
edited November -1 in Working with GS (Mac)
Hello GS'ers,

I have two actors, Actor "A" and Actor "B". A is controlled by a left and right joystick. Left stick is for moving, and Right stick is for angle (or for turning your character to face the way you want to walk). I'm trying to get B to move towards A. I've done that. Here's my problem. Actor A moves around on the scene. Actor B is always facing the same way. If actor A starts on the North end of the map, Actor B moves towards him from the East (with his eyes facing actor A to the West), actor A moves to the South, Actor B moves towards him, with his eyes still facing west. Can I have B move and angle himself so he's always facing A?

I hope I explained this well, i'm kinda confused by it. Sorry, if it's sounding weird.

Title edited by BeyondtheTech: please try to keep your thread titles descriptive for everyone's benefit. Thanks!

Comments

  • RHRH Member Posts: 1,079
    Use the rotate to position behaviour with the actor A's X and Y co-ordinates?
  • ORBZORBZ Member Posts: 1,304
    Constrain actor B's rotation to always point towards A

    Promote A's x/y position to game attributes (real)

    Constrain B's rotation to vectorToAngle(Ax-Bx,Ay-By)
  • GingerBGamesGingerBGames Member Posts: 390
    I'm going to post this, if anyone can show me, via notes how to do this that would be great.
  • GingerBGamesGingerBGames Member Posts: 390
    It's been posted, i just used some templates on GS to get my point across. I didn't want to use my actual game graphics. Thank you to anyone willing and able to help me with this.
  • GingerBGamesGingerBGames Member Posts: 390
    Is that a "Rotate To Angle"?
  • GingerBGamesGingerBGames Member Posts: 390
    I'm sorry, I just cannot seem to get this to work for me. In rotate to angle, i choose vector to angle (x,y) should be = vector to angle(game.x,game.y)?
  • GingerBGamesGingerBGames Member Posts: 390
    Would this be a Constrain Attribute, or a Rotate To Angle?
  • GingerBGamesGingerBGames Member Posts: 390
    Oh my gosh, yes. Thank you, thank you, thank you. This helped so much. Man you deserve a cookie or something. Thank you all for the advise,as always, you've been a great help.
  • ORBZORBZ Member Posts: 1,304
    as i said before.. constrain self.rotation, no need to use rotate to angle.
  • GingerBGamesGingerBGames Member Posts: 390
    Yes, that's where I was getting it wrong. You've all helped a lot, so everyone deserves a Monster Cookie.
Sign In or Register to comment.