My character follows the mouse, but keeps turning upside down

Asked

Viewed 333 times

3

My character moves ('flies') following the mouse, but he is at all times turning sideways or upside down. Does anyone know how to solve this? (for him to remain standing, as is the Prite)?

When I change the Set Angle Toward to Set position (image below), the Player stops turning upside down, but then it keeps moving (following the mouse) very fast, ignoring the Behavior of Bullet (which is in the speed 40).

Behaviors that the Player has are: Boundtolayout + Bullet + Solid.

I’ve been trying to figure this out for two days, so I really appreciate it if someone can help me.

Eventos e ações para o player seguir o mouse

  • Hello. If you provide a link with a Complete Minimum Example, it would make it very easy for someone to help you. Otherwise, people will need to keep guessing the possible problem of your game.

1 answer

4


How the character has the behavior Bullet activated, I believe that a possible solution is to use the method Set angle of motion (that behavior), instead of Set angle toward of the character.

The parameter entered in the method call is the angle between the object and the mouse cursor:

angle(Self.X, Self.Y, Mouse.X,Mouse.Y)

  • In the character’s action, it is as follows:

Chamada do método Set angle of motion

  • So that there is no rotation of the object during the movement, the property Set angle of behavior Bullet must have the value No:

behavior Set angle

  • With these changes, the result is:

Resultado

  • 1

    Hi, @Gomiero. Thanks for the help! That’s exactly what I needed. Thanks! :)

  • 1

    @Ailsonbezerra mark the answer as then accepted to close this question.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.