0 votes

I have some code who rotates parts of the character based on the mouse position:


if rotation_degrees > 80 or head.rotation_degrees < -80
        apply_scale(Vector2(-1, 1))

But when it reaches this condition, it applies the scale multiple times until the condition becomes false, its a "loop" similar to what happens with the animations, but with animations we can check what is the current animation with get_current_animation()

I know I could just check the current scale to see which position he's pointing, but by change it directly it don't work the same as apply_scale.

asked 5 days ago in Engine by Aryn (40 points)
edited 5 days ago by Aryn

are you trying to get a sprite to face the mouse position? if so you can get the value "rotation_degrees" from a node and change this value directly. also note there is a function that can give you a new rotated vector using Vector2.rotated(float phi)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.