Music Tweaks, and Pac-Manimation

Published April 01, 2011
Advertisement
I've tweaked the music--instead of the drum track stopping when the player isn't eating pellets, it drops to one-third volume. It's an improvement, but it still seems a bit jarring. I think I'm going to ramp the volume up or down over a beat, or maybe half a beat. Quick, but more gradual than an immediate jump from full to one-third volume.

I also have the player model doing an eating animation now. It was easier to implement than I expected. The model is essentially a three-quarter sphere, like a globe placed sideways so the polar axis goes horizontally. Vertices are given an additional parameter (currently called "group" due to lack of proper descriptive skills), with all vertices on one longitudinal arc being given the same group number. These are numbered sequentially from 6 on the "upper lip" to -6 on the "lower lip."

I take the time since last beat over the beat length, multiply this ratio by 2 pi. The absolute value of the sin of that gives me a variable that goes from 0 to 1 to 0 to 1 to 0 over the length of a beat. (If you can think of a better way, let me know.) This "chomp factor" gets passed to the shader that draws the player. There's a check to make sure the player is moving before that calculation is made. If the player is stopped, the variable is set to 0.

In the vertex shader, I construct a rotation matrix. Vertices on the upper lip are 45 degrees off the horizontal. Their group is 6; 45 / 6 = 7.5. So I take group * 7.5 * the chomp factor to determine how far to rotate the vertex this frame. Longitudinal arcs farther back have lower group numbers, and those on the bottom of the model have negative values, so it works out pretty well. The mouth closes a given amount, and the other vertices space themselves out evenly as the surface of the player model expands.

It worked on my first try.

I likely need graphics to better describe the method. I'll get them up soon.[s] Also, no video with this update, much as I'd like to. It takes a couple hours to upload a video to YouTube on our connection, and the housemate works from home on Fridays; I don't want to eat up his bandwidth. I'll do my best to get one posted Sunday or Monday.[/s]

Video:
[media]
[/media]
Previous Entry New Video, with Sound!
Next Entry Bloom!
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement