I am trying to use another approach to make an animation_tree;I set a Sprite2d and using a png file for the texture propriety; according to its form i indicated Hframe and vFrame. The problem is thath the width os the section is too large… how could I set the appropriate width value??I dont see any field that stands for width…
Tanks in advance to who will help me.
You could set a region for the sprite, but if you want to use the basic sprite sheet features in godot you will need to have a uniform sprite sheet image, where each frame is exactly the same size.
ok, I see, I added rect and by click on Modify region I can select the various frame but also adter I select one of those and The resulting frame looks correct the x,y width and hength attributes are corrects but It is not what Is shown up on the screen…I dont know what is the mistake…
Could you show what you expected to happen versus what really happened? I don’t follow what you’ve done, modifying the region on a sprite2d should produce a visible result.
Using both region and hframes seems to be your issue. I would recommend cropping this sprite sheet, and ensuring the sprites are uniformly sized; it seems like the zombie has varying distance between each frame, and a lot of extra padding.
You could make seperate images for each frame, but I am recommending normalizing your empty space, notice your sprite has a little space at the start, then medium spaces, and a large end space (1, 2, 2, 2, 2, 3 widths) and a ton of empty space padding the bottom.
The smallest rectangle that fits each character image is 84x132.
In a graphics editor create a grid of that size.
Cut and paste each character image into a cell of that grid
Choose a piece of the character that is immobile in the animation and use that to keep the image centered in each grid square.
The characters left foot seems to be planted in the same spot for each frame. It is the bottom-most point and two pixels back from the right-most point.
Use that to center your character.
Or just use this one that I made:
when I create new animation (e.g. walking) and set new image as texture, It happens the texture come back to another one I used for another animation…how should I manage the problem?..
You need to add a track with the texture as well. So the same way you added a track for the frame, you need to add a track with the key button next to the track property.
If I set on Sprite2d.Animation hframes:6 and vframes: 2 such that I could pick each frame but when I click on key+ icon for adding the next frame It remains the former frame, the 0th…What am i doing wrong??
I wouldn’t worry too much about the key+ functionality, if you change the playhead it will revert to the previous frame. Have you tried using an AnimatedSprite2D instead of a Sprite2D + AnimationPlayer?
Mmmm, I cannot understand the resason why If I set a Sprite2D whose Hframes and Vframes are equals to 6 and 2 respectively, Frame is set to 0 and I cannot change the value…
How are you trying to change the frame value? does it work with hframes or vframes other than 6 and 2? If you are using an AnimationPlayer are you sure that it’s stopped and not playing? or else it will overwrite any value you try to assign.
If you are using this image, then it still has a ton of padding at the bottom; 2 vframes will not look great.
Maybe you should edit the animation keys in the Animation panel. Clicking on one of the track keys will open it in the inspector where you can change the value to any frame.