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)
asked Apr 2 in Engine by stackers (15 points)

1 Answer

+1 vote
Best answer

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

answered Apr 2 by njamster (8,788 points)
selected Apr 2 by stackers

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 How to use this Q&A? before posting your first questions.