How to make an Image turn to direction?

salochin59salochin59 Member Posts: 25
edited June 2012 in Working with GS (Mac)
I used some of the Cheap AI tutorial for my own game. I have enemy space ships flying to random spots. My question is though. How do I get the images to turn the direction they are heading to?

Best Answer

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    edited June 2012
    constrain rotation to vectorToAngle(self.motion.linear.velocity.x,self.motion.linear.velocity.y)

    Make sure the images for the ships are facing towards the right
  • salochin59salochin59 Member Posts: 25
    I am using constrain attribute with what was suggested up above and it is not working.
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Well then most likely You did not make your original image face to the right before you ever loaded it into the actor.

    Please do not Reject an answer just be cause you do understand or cannot make the answer work. He gave you an answer that works. Now you need more info to understand it.
  • salochin59salochin59 Member Posts: 25
    I think you miss understood why I rejected the answer. I did not want this discussion to be passed over because the status says "answered". In my mind that meant "finished". This discussion is not "finished". I appreciate the answer don't get me wrong. I did not mean to be offensive. Anyway back to the point. It is not turning at all. Even if I had the image not facing the right direction it would still turn right? It would just look weird. Can you please tell me what I am doing wrong? What I did was added Constrain Attribute. Then I did self.rotation or EnemyShip.rotation in the first box. The second box I put vectorToAngle(self.motion.linear.velocity.x,self.motion.linear.velocity.y) like he suggested.
  • salochin59salochin59 Member Posts: 25
    I am sorry. I am sure what you guys are telling me is correct. It is just not working for me. I rotated the image 90 degrees to the right in Paint.net and re imported it. The image is a .png. I may have it setup in a way that it does not work to begin with. I am not sure.

    I used this tutorial without the mouse reaction.



    and tshirtbooth's above

    http://gshelper.com/how-to-rotate-in-the-direction-traveling-with-gamesalad/

    Is the AI tutorial messing up tshirtbooth's tutorial or am I still setting up the image wrong?
  • salochin59salochin59 Member Posts: 25
    The spaceships are spawned by a spawning actor. Hopefully that helps narrowing it down.
  • salochin59salochin59 Member Posts: 25
    edited June 2012
    Thank you for the response guys. Especially you tshirtbooth. Your videos are extremely helpful. Obviously I need a lesson on proper forum etiquette. What does it meen then to accept or reject an answer? I used to not do anything but I noticed the pop up wont go away until you do. I thought it was a matter or communication. If you accept. The discussion is done. If you reject the discussion is still alive. I am not trying to be rude. I dont understand what I did on your end to piss you guys off. Again. I thought when you "accept" the answer that meant the discussion is over.
  • salochin59salochin59 Member Posts: 25
    Alright well I decided to use the Rotate to Position attribute. It does not produce the exact result I was looking for but the image is rotating like I was asking. The rotate is delayed. It turns while moving instead of turning before moving.
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    If you do what i and every said with the vectorToAngle, it will give you the wanted results. If you want you can send the project to my email and ill take a look. Its in my signature.
  • machinegunkellymachinegunkelly Member Posts: 56
    I do have to agree with Salichin59 that the forums pressure pop up to have you "accept" or "reject" an answer is part of the problem.

    You feel like if you select "answered" that no one will assist you.

    It's an annoying feature IMO, and if you never get the right answer, it still prompts you to accept one FOREVER.

    Thats all I wanted to say, but this thread did answer the same question for me :)
  • machinegunkellymachinegunkelly Member Posts: 56
    Gotta say, vector to angle worked perfectly for me... thanks guys :)
    So this thread answered someones question at least
Sign In or Register to comment.