Where am I going wrong here? Vector to angle then wait to launch

brvidsbrvids Member Posts: 8
edited May 2012 in Working with GS (Mac)
So I'm trying to launch my projectile from a cannon. I want to add a wait time for the cannon to rotate to the angle where the user taps so that the projectile comes out of the cannon. Otherwise the projectile launches instantly and it looks like it's coming out the side. What's wrong with what I'm doing?

http://www.flickr.com/photos/79061471@N08/7237421570/in/photostream

In my mind this looks like it should rotate to angle, when mouse is pressed down, wait .1 second(giving enough time for cannon to rotate), then spawn actor. No?

Best Answer

  • tatiangtatiang Posts: 11,949
    Accepted Answer
    What is your full expression for the angle? By the way, if you click the expression editor, you can then move the expression editor window and take a screenshot showing the full expression.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Answers

  • brvidsbrvids Member Posts: 8
    Well I tell you man I may have spoke too soon. By some miraculous act of god I seemed to solve my problem by adding an attribute under the created rule that said self.rotation = vectortoangle(vectorToAngle( game.Mouse.Position.X - self.Position.X , game.Mouse.Position.Y - self.Position.Y ) but I would still love to know how I would do it if I were to use a timer? I guess what I did was check for the angle before it launches.

    My full expression for the angle is:
    max(55,min(125,vectorToAngle(max(55,min(125,vectorToAngle( game.Touches.Touch 1.X - self.Position.X , game.Touches.Touch 1.Y - self.Position.Y )))
Sign In or Register to comment.