#Problem with my character flip.
1 messages · Page 1 of 1 (latest)
Are you sure that is from the sprite?
When you click the node, does it turn orange?
Yes
This will only happen if the node being "flipped" doesn't have its origin centered where you would expect. Double check your node tree and you'll find one not centered.
In the first image above, there is only 1 origin.
And there are 2 nodes.
In the second image, there are 2 origins. Something else is happening there
Why does the first image have only 1 origin? From which of the 2 nodes is it?
(Well, there are 3 nodes with a 2D position. But i assume at least 2 of those are overlapping)
There are 3 of them: The CollisionShape, the Anim player and the Player Node
Which are centered perfectly
In the second image they are not centered in the same position
However whenever i flip the Anim Player, it's not centered at all
That is not normal. Changing the flip_h property does not affect the actual position of the node.
Are you flipping it trough the AnimationPlayer?
The most likely thing happening here is that some animation is modifying the position of either the CollisionShape or the AnimatedSprite.
I do not have enough context for any other ideas.
Mhm....
And the problem is that all of my animations are on the right direction
And the flip works like that for all of my animations
That should not matter much if the AnimatedSprite is properly positioned.
In my project i just use flip_h and it all works as intended.
Is it because it's not pixel art ?
No. The position of the node is being moved by something
The fact that the second image has a node moved is the issue
The AnimatedSprtie2D is the problem
Look at the sixe of the box you will understand i guess
The AnimatedSprite is not centered to the sprite there.
The orange cross should be in the middle of the samurai there
The texture you used seems to have a bunch of empty space.
The texture itself should have the character in the middle. This is not set from the node necessarily
AnimatedSprite lets you customize the size of the canvas of the individual frame.
But it will be a pita if you have to do this for a bunch of them.
And it is done when adding the frame.
Yeah but it's just to show you that it will indeed take ages
But yeah i will show you the AnimatedSprite2D
Does the sheet have a LOT of sprites?
Do any of those animations have the same set of sprites? Because if so you can just delete the duplicates.
You do not need an AnimatedSprite animation per AnimatedPlayer animation necessarily
At every 1st frame i put my idle animation as a basis for my drawings
The one you saw earlier
Can you explain please ? I don't know what do you mean by that
For example, if 2 animations from AnimationPlayer use the same set of frames. You can use the same set of frames for both.
With set of frames i mean AnimatedSprite animations
Ah i see, but the problem is, that every animations are unique and there are rarely or for most of them not the same set of frame
Damn, best of luck.
You have to modify the texture for each frame, and make sure the character is in the center of each.
The texture...
The image files.
You'd have to modify each of them, then re-add them to each animation.
Don't even need to do that
I found a quicker way eheheeh
Do you see the Offset on the AnimatedSprite2D ? I just have to increase the Offset value on the inspector and it's good, on x axis
I imagined that would apply when flipped too.
But if it works then that's great!