This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

I have a spritesheet that is 32x32 pixels. I'm told that in order to use the AnimationPlayer, I have to set the vframes and hframes. But when I do this, each time I increase the frame by 11, the sprite will "shift up".

Here is the sprite in question. The sprite is quite large, and is 384x4608 pixels total.

Here's what I've done (with pictures!):

1) On frame 0, I align the vframe/hframe until I see the image correctly display a single character

2) Increase the frame, but the character starts to shift upwards every 11th frame until you see two characters inside the same grid.

3) On the right you can see that each grid is 32x32 pixels, so the spritesheet (a snippet) itself is okay.

enter image description here

TLDR: Can someone explain:

1) What is the correct vframe/hframe for this sheet?
2) Why is this odd shifting happening?
3) How do you correctly calculate the vframe/hframe for any sized image?

in Engine by (20 points)

The texture is a bit large, try cutting it to the size you need (8x10 frames for a character) because going over 4096 could give some issues.

1 Answer

–1 vote
Best answer

1) What is the correct vframe/hframe for this sheet?

Vframes: 4608 / 32 = 144
Hframes: 384 / 32 = 12

2) Why is this odd shifting happening?

Probably because Vframes is set to 130 when it should be 144. If it occurs when everything is apparently correct, it could mean the error is in the image itself (characters are offset from the 32x32 grid somewhere in the sheet).

3) How do you correctly calculate the vframe/hframe for any sized image?

Divide height/width of sheet by height/width of one frame to get vframes/hframes.

Aside, i agree with eons that you should probably think about cutting the texture into smaller parts.

by (470 points)
selected by
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.