Godot Version
4.3
Question
My question:
Am I missing some kind of configuration? Did I set up the animations wrong? Or is it a weird bug?
Problem:
Animations appear to load inconsistently and not play correctly while running the game. The run works only after rolling, but the rest play the wrong animation with the wrong hframe setting.
Secondary problem:
Often when playing the animation from the interface, the first time has the wrong texture loaded and it uses the wrong hframe numbers. While it is playing, if you press the play button again, it will start playing everything correctly. No configuration change happened.
Nodes used:
Sprite 2D
Animation Player 2D
Texturing:
Canvas texture
Diffuse PNG
Normals webp
Specular webp
Animation Config:
The key for the canvas texture, diffuse and specular are all set at 0, the beginning of the animation.
The frames are set as needed for the actual animation.
The h and v are set properly for the texture.
Process:
Create animation in animation player.
Select sprite 2d node.
Define new canvas texture
Drag and drop diffuse texture.
Drag and drop normal texture.
Drag and drop special texture.
Click the key icon for canvas texture and the 3 texture files.
Set the h and v, and click to key frame them.
Set the snap spacing and animation length.
Click the key to add all the frames.
Verify all the key items exist in the defined animation.
Play to preview and adjust key frame spacing.
Press play to test the game and see everything not rendering according to the state.
State Management:
The player controller is a state machine. The first setup had the animationplayer.play() running the different animations on all the enter state events. Then, I changed it to have a single play() and then all the enter state events had queue(). Both setups resulted in the same thing. The label above the character head always says the proper state name. The animated sprite 2D always did as expected with the player state controller. Problems mostly happened not when switching to animation player, but when using the sprite 2d with the canvas texture, in order to have the ability to use normal textures.