Something I need to ask about

So for my halo game. I have coded his head to move and look up and down, but the problem is you can rotate in a full circle. How do I make it so that the head cannot rotate 360, and turn it like us humans.(looking up, looking down but down down)
So here is how it looks if the sprite looks at the mouse on top- left corner
Screenshot 2022-08-16 8.36.43 PM
Here is how it looks it you look down mouse down-right
Screenshot 2022-08-16 8.36.34 PM
How I ant it to be
Screenshot 2022-08-16 8.37.02 PM
Screenshot 2022-08-16 8.36.55 PM
So technally if you try to do this
Screenshot 2022-08-16 8.36.43 PM
Screenshot 2022-08-16 8.36.34 PM
it would not work and would stop you from doing that. But how?

2 Likes

If rotation is > 45 then don’t move the head.
If rotation is > 135 flip the head and allow it to move.

For the up direction If rotation is, > 225 don’t let the head move.
If the rotation is > 315 let the head move again and flip it back.


These values would need to be adjusted to be what you need, this is just an example.

3 Likes

Thank you CodeAlpaca!

3 Likes

So tehnally the > is less than for the filter but what is “if” as a code?

1 Like

So if it rotates to 45 how to stop it?

1 Like

X > 45 means that X is greater than 45.

Use an extractor to get the Rotation, then with that, you can use different filters to stop/allow rotating in a specific direction. (I did this in my head so there may be slight adjustments you’ll need to make)

1 Like

Thanks CodeAlpaca again couldnt have done it without your help! I have also added this to some other spirtes!

1 Like