Cute game! I love the bear movement. How was it done??
Viewing post in Fat Bear Week jam comments
Thank you! I'm so glad you enjoyed the movement, it's a little complicated 😅. Basic overview is:
- Head rotates toward mouse position
- player position turns toward head's rotation while moving
- current speed is determined based on input and current bear size - larger size makes player accelerate slower and makes speed degrade slower when the player releases the arrow key (to make the bear seem really heavy when it gets bigger)
- use godot physics to update the player position based on velocity
- Player position then updates a "chain" of 4 body positions: neck -> front body -> middle body -> back body. The neck is where the player node's position is, and then the other 3 are clamped a set distance from the point in front of it each frame. This video explains it pretty well!
- Legs are also procedurally animated, basically they know where they'd be if they'd just taken a step, and if they're too far away from that position they lerp towards it each frame
- Bear mesh is re-made each frame by updating the points on a Polygon2D based on the body, leg, and head positions and a bunch of const offsets from those points!
I just added the project to my github if you want to take a look at the script!