How to make a arrow?

fangang191fangang191 Member Posts: 4
edited November -1 in Tech Support
I want to make a arrow game but how to make it always point the direction it is going.
tell me or give me a sample send it to me . Thank you .
email youyishouge5@163.com

Comments

  • scitunesscitunes Member, Sous Chef Posts: 4,047
    create an attribute called facingright. In your arrow shooter create a rule that says when right arrow is down change facingright to true. Another rule - when left arrow is down change facingright to false. then create a shoot arrow rule - when shoot button is down AND facingright is true spawn rightarrow (set direction to 0 degrees) (in the rightarrow actor use a change velocity behavior and set the speed. the angle should 0 relative to actor not scene) then do the oppocite of this for when shoot button is down AND facingright is false. (you'll need a leftarrow with the image flipped)
  • fangang191fangang191 Member Posts: 4
    http://www.officegamespot.com/officegames/arrow_shooter_03.swf
    I want to make a game like this one. look at the arrow ,it change its direction during flying.
  • Fafnir312Fafnir312 Member Posts: 161
    In your arrow create a "Rotate to" behavior. In the angle field use the "vectortoangle" function. Then input the arrow's x and y linear velocity so that it looks like this: vectortoangle(self.linearvelocity.x, self.linearvelocity.y)

    This will make your arrow always point based on what direction it's going. You may need to add or subtract 90 degrees based on which direction you created the arrow to be pointing.

    Alternately you could do the same but with the arrow's actual rotation - self.rotation and a "Constrain Attribute" behavior.
Sign In or Register to comment.