For my game I want to be able to fire projectiles in a parabola and I understand that I can do this using the mouse position and then use tan^-1 (which I think is the same as arctan) to find the angle: https://www.mathsisfun.com/polar-cartesian-coordinates.html. Am I able to use the tan^-1 function in the expression box or is there some other alternative???

Thanks, Cameron

u should explore to find an alternative

Also is there a way of doing square root?

I wonder if sqrt works.

Hey @16mccullochcam - interesting question! Ok, so I have a few answers for you

**First Answer **(*not answering your question*):

If you want to make a launcher fire projectiles at your mouse, and have the projectiles follow a parabola, the **simplest** way is to just use a *Point At* behavior to point the launcher at the mouse, then make sure the objects you emit have gravity enabled. When you emit projectiles, they will move in a parabola, and you can control the physics settings (drag restitution, etc) in the emitted object’s properties. This is probably what you want if you’re making an Angry Birds or Worms type game or something.

**Second Answer **(* still not answering your question*):

There is a *Function* behavior block that can be set to tangent (or arc tangent, or sine, etc) You could use this instead of an expression, just keep in mind that the output may not be what you intuitively expect. Since Flowlab only communicates integers, the outputs are scaled from 0-100 instead of 0-1.

**Third Answer **(* actually answering your question*):

Yes, you can use a tangent function in the expression box. I’ll let you in on an undocumented secret: the expression parser supports most of the Haxe programming language, not just arithmetic expressions. You can use any of the Math functions listed here: https://api.haxe.org/Math.html

For tan, you would use: * Math.tan(A/0.01745)* (0.01745 is pi/180, to get radians from your angle, which is what the tan function expects)

For square root, you can do this: `Math.sqrt(A)`

Here’s an example I just knocked together that uses sin/cos to orbit a sprite around the mouse cursor: http://flowlab.io/game/play/768960

Here’s a quick explanation of the expressions in that demo:

Start with the equation listed here https://gamedev.stackexchange.com/a/9610

```
`X = originX + cos(angle)*radius;
Y = originY + sin(angle)*radius;`
```

- I used the mouse position (set to
**B**) as the origin - I chose
**40**as a radius - I increase the angle (set to
**A**) every frame, but divide it by**200**to rotate in a smaller increment - I convert the angle to radians for the cos and sin functions by dividing by pi/180, or
**0.0174**

That leaves us with:

```
`B + (40 * Math.cos((A/200)/0.0174))
B + (40 * Math.sin((A/200)/0.0174))
`
```

WOW, Thanks so much grazer!!! This is really gunnu help a lot with my game :D, If you want I can post my game here once I’ve got it working.

Thanks!, Cameron