Topic was automatically imported from the old Question2Answer platform.
Asked By
Anastasia
Hello there! Please help!
I ran into this problem. I’m using an animation player with a bunch of different sprites (8 to be exact) and all of the animations go into the animation tree to make walk/jump/etc amimation.
But the little robot is facing right and when I’m walking left and i use Flip_h this way I run into a problem:
This is how i flip it probably there’s a better way to do it but…
The problem is that the arms/legs and the pinnk feathers around his head dont flip around their pivot point they just. Look: image 1 image 2 image 3 image 4
Looks like you have a Node2D that contains your entire sprite tree. You could change the scale.x of that node to either1 or -1 depending on the desired facing direction.
Thank you so much! Does scale work like flip or do i have to write $body.scale(1,-1) or smh because I cant seem to get it right
Anastasia | 2020-02-16 16:04
In your image of the scene tree, body looks like a sprite. I’m talking about the Node2D that contains all of the sprites (so, one level higher).
$Node2D.scale.x = -1
… or …
$Node2D.scale.x = 1
depending on which direction you want…
jgodfrey | 2020-02-16 16:09
I also removed everything but the body lines because i dont need em anymore!
Looks like you’re still changing the scale on $body. What happens if you instead change the scale on the containing Node2D (the one containingbody)? The obvious difference there would be changing the scale on the Node2D would also have the effect of flipping the AnimationTree and the AnimationPlayer (as they are also children of the Node2D).
As I’ve never tried to the scale-flip trick on some of these components, I’m not sure how they’ll react, but it might be worth a try…
jgodfrey | 2020-02-16 16:58
Invalid get index ‘scale’ (on base: ‘GDScriptNativeClass’)
I get this
Anastasia | 2020-02-16 17:07
Ok ok it does no longer do that. but. it does not longer flip either
heres the kinematic body code