Angle actor 1 image to face actor 2

dereklaruedereklarue Member Posts: 121
edited November -1 in Working with GS (Mac)
Im fairly new with GS, so I'm running into a few problems that I'm not sure how to face..
Ok so I'm using global Attributes PlayerX and PlayerY on Actor 2 (Constrained of course),
So, my question is...
How do i get Actor 1's image to always face actor 2?
btw...Actor 1's image is facing to the right, (think thats 0 degrees for GS?)
Thanks in advanced. :)

Comments

  • rebumprebump Member Posts: 1,058
    The user Bluefusion here at GS has a demo project of actors following and always facing the player. Check his games/projects out.
  • dereklaruedereklarue Member Posts: 121
    Doesnt really help, because it doesnt explain how it was done :(
    Guess i could askin him/her...
    thanks
  • rebumprebump Member Posts: 1,058
    Sorry. I thought he made it downloadable. When I get in front of a Mac again, I'll see what I can scrounge up. I know you need to save the X/Y position of the actor to be followed and then use those values in a move or accelerate to behavior in the following actors but I cannot recall the rotating the actor piece off the top of my head right now. Probably used a Move To.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    The is a cannon template...

    In that template, the cannon always rotates towards the mouse. You could replace the mouseX and Y with the actor you want to face X and Y...
  • harrioharrio Member Posts: 234
    what's cookin,

    if i understand you correctly, you'll want to save the x/y values of the target actor to constrained, game level attributes. so that they maintain the actors data when it moves.

    then you will place these values into a 'rotate to position' behavior in the actor you want to rotate. http://gamesalad.com/wiki/behaviors_reference:rotate_to_position

    the behaviors section http://gamesalad.com/wiki/behaviors_reference and the wiki itself
    http://gamesalad.com/wiki/start
    are always the best place to start looking for solutions. that way, you will have a better understanding of what you are implementing and why. as opposed to just being told 'do this or do that'.

    this is a great community and they will usually show you where the information comes from, so you can investigate it yourself for better understanding.

    hope this helps. if it is not what you are looking for, let us know.

    noodles...
  • dereklaruedereklarue Member Posts: 121
    Figured it out, What i did:

    using Global PlayerX, PlayerY constrained to Actor 2
    In Actor 1:
    Rotate to position:
    game.PlayerX , self.position.X
    game.PlayerY , self.position.Y

    Thanks guys!
  • rebumprebump Member Posts: 1,058
    Yeah, that was it. Rotate to Position. Man, I wish I had a Mac at work so I could mess with GS during the day.
  • harrioharrio Member Posts: 234
    what's cookin,

    excellent. i couldn't have said it better my...oh wait...lol

    noodles...
Sign In or Register to comment.