How to use x and y to get angle and +-

I don't get how or which option i should use to turn x and y into angle z*.
I need it for spawning projectiles, so they look like a water gush.
Also how do i make +-? If i get that angle is 45* how do i make 45*+-5*?

Thanks in advance!

Comments

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    If angle is 45, +-5 would be 40-50

    Use vector to angle(farX-selfX,farY-selfY)
  • hamarohamaro Member Posts: 31
    Okey, but how do i write +- in the function? cause when i write just +- in the it doesn't work.

    Isn't there some way to just take x/y to get angle to? :)
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    @hamaro, @jonmulcahy gave you the formula for converting x & y values to an angle. To do +/-, just take the result of that formula and add a random number: +random(-10,10)/10*5.
  • hamarohamaro Member Posts: 31
    okey, thank you both!
Sign In or Register to comment.