Hot answers tagged animation
4
Each object should have its own bone. Each bone should be unconnected to the others and able to move freely. This allows you to animate each bone, with position and rotation, while still keeping the model as one. Each bone is really just a matrix to apply to the vertices under it's control. It's simple to imagine applying a translation and rotation to each ...
4
You are essentially creating 3 coordinate systems when you only need 2.
The coordinate system for your grid is 0 to 800.
Your "real" space is a normalized position from 0 to 1.0.
And your "screen" space is measured from 0 to whatever your pixel width is.
You will always need to convert between some kind of world coordinate system and screen space in order ...
2
I would recommend using Console.WriteLine("some text") in the future to determine whether or not your code gets reached, in this case:
if (Keyboard.GetState().IsKeyDown(Keys.D) && Keyboard.GetState().IsKeyDown(Keys.W))
{
Console.WriteLine("D and W pressed!");
jumpRight(gameTime);
vel.X = +2;
}
If the message is printed, it could be ...
1
The way I would do it would be to have my character object have it's own render method, and a member variable to hold direction data. You could make an enum to define the different possible states if you wanted to.
Then within the render method, check what state the direction is in (possibly using a switch/case) and render the corresponding sprite.
Wherever ...
1
One way to make such an effect is UV animation.
The UV is a texture coordinates, as XYZ is the objects coordinates, what is done here is simple. Given the following texture with the mention that it needs to have an alpha channel so that we can exclude the blue color and leave just the clouds, it is going to be applied to a quad
Let the upper left ...
1
Vertex tweening for animation is an outdated technique, and there aren't many good reasons to use it in modern graphics code. I'm fairly certain it isn't even supported at the API level in D3D10+ (although you could always still implement it yourself).
One of the big problems with it is that it requires complete copies of the vertex data for each keyframe, ...
1
Please note that although you said that you wanted to check if D and W keys were pressed simultanously, you don't. What you do is, you check if the D key is down. Next, you check if the W key is down. Nothing in your code makes sure that both are down at the very same time. Any time you call GetState you query the keyboard for it's state. In your code, you ...
Only top voted, non community-wiki answers of a minimum length are eligible