How to make your character hold something/rotate

type the stuff underneath this but without spaces next time
< drftggyujhgfdghujjyhgtfdtyuiyjhg >

3 Likes

So…
This is because sometimes the rotation acts janky and sometimes sets the rotation to a negative… even though angles can’t be negative.
To fix this, put the number through a filter. Make the filter number 0 and the operation Less Than. On pass, go through the A and eval of an expression block. In the expression: A * -1
Then connect the out of the evaluation to the filter. Also remember to send the fail of the filter you just made to the filter in your screenshot.
Boom.

3 Likes

Or you could try this in the expression:
A<0? A+360:A

But that screenshot has nothing going into the switch, I suggest removing the switch and using the filter pass and fail to directly toggle flip. Also the rotation starts from the right, so you want to flip if its > 90 and < 270. On last thing, the gun is sometimes behind the player, make sure the gun is set to display order 2.

2 Likes

One question: What does the :A part do?

2 Likes

Its a question with a yes and no answer.

Is A less than 0?
If yes: Add 360 to the negative number
If no: output the number normally

A<0? A+360:A


//In programming terms, it's called an if-statement.
And the syntax looks like this://

if (A < 0)
   A + 360;
else 
   A;
4 Likes

Ohh thanks :blush:
Now I know how to do stuff on the expression (other than A+B :upside_down_face: )

3 Likes

it keeps getting stuck like this, and wont turn back around…image

3 Likes

You need to set the mouse to game coordinates.

image

4 Likes