0 votes

I was first flipping my sprite with $Sprite.flip_h, which worked fine with the animations, but I want to add more sprites to this scene, and don't want to have to flip each one.

So I replace that with self.scale.x = -1, and my scene (character) seems to flip back and forth really fast, it looks like it's flickering. Seems like every frame it's switching back and forth.

(this isn't totally accurate, it's much faster).

I'm guessing that the animation is setting the self.scale.x property each frame as well, which is causing the problem, but I can't figure out where or how.

This is my scene layout:
enter image description here

and the function:

func move(delta):
var input = ZERO
input.x = Input.get_action_strength("ui_right") - Input.get_action_strength("ui_left")
input.y = Input.get_action_strength("ui_down") - Input.get_action_strength("ui_up")
input = input.normalized()

self.scale.x = -1

if input != ZERO:

    #if input.x < 0:
        #self.scale.x = -1
        #self.scale.x = -1

    velocity = velocity.move_toward(input * SPEED, ACCEL * delta)
    velocity = velocity.move_toward(ZERO, FRICT * delta)

velocity = move_and_slide(velocity)
in Engine by (15 points)

1 Answer

+2 votes
Best answer

That's a known issue. Also check out my comment over here.

by (10,583 points)
selected by

thanks,self.scale.x = self.scale.y * 1 worked

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 Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.