Help the Programmer animate
Well I made my standing frame for my character, using an extremely simple style(cause of my lack of art skills).
Now I want to make a 3 state walk sequence(1,2,1,3) with the above image as 1, and to have 2 as left hand forward and right hand back, and have 3 as the horizontally flipped image of 2. I want this view so for when I want a different view I just rotate the image. I know this is a bad shortcut but I'm a horrible artist, and I'd like to get one of my game ideas going with these simple graphics and then recruit later when the driving engine behind the game is finished.
AMP Minibowling - Free asynchronous multiplayer mobile minigolf+bowling
[twitter]eedok[/twitter]
Umm... Is there a question, or do you want to help? It seems you're just saying something random without a prompt to respond...
Now, perhaps it'd be nice if you would at least let us know if you're using OpenGL, DirectX, or just your typical VB interface, or the likes.
Anyway, I'm going to assume by the fact that you don't sound like a complete n00b that you're at least using OpenGL by now. No? If not, you really should learn as soon as you possibly can. I suggest http://nehe.gamedev.net for tutorials and stuff. Just start at lesson1 and work your way through. It's how I learned. ^^
Anyway, assuming you are using OpenGL, you'll have two images, correct?
One where the hands are even...
And one where one of the hands is in front, the other is in back.
Frame One:
glBindTexture(GL_TEXTURE_2D, FirstImage.texID);
glTexCoord2d(0,0); glVertex3f(0,0,0);
glTexCoord2d(1,0); glVertex3f(10,0,0);
glTexCoord2d(1,1); glVertex3f(10,10,0);
glTexCoord2d(0,1); glVertex3f(0,10,0);
Frame Two:
glBindTexture(GL_TEXTURE_2D, SecondImage.texID);
glTexCoord2d(0,0); glVertex3f(0,0,0);
glTexCoord2d(1,0); glVertex3f(10,0,0);
glTexCoord2d(1,1); glVertex3f(10,10,0);
glTexCoord2d(0,1); glVertex3f(0,10,0);
Frame One:
glBindTexture(GL_TEXTURE_2D, FirstImage.texID);
glTexCoord2d(0,0); glVertex3f(0,0,0);
glTexCoord2d(1,0); glVertex3f(10,0,0);
glTexCoord2d(1,1); glVertex3f(10,10,0);
glTexCoord2d(0,1); glVertex3f(0,10,0);
Frame Three:
glBindTexture(GL_TEXTURE_2D, SecondImage.texID);
glTexCoord2d(1,0); glVertex3f(0,0,0);
glTexCoord2d(0,0); glVertex3f(10,0,0);
glTexCoord2d(0,1); glVertex3f(10,10,0);
glTexCoord2d(1,1); glVertex3f(0,10,0);
Just switching the U coordinates 1<->0 is all it takes to flip the image horizontally. You could do something similar by switching the V coordinates 1<->0 to flip it vertically.
Hrm...
Okay, if you know OpenGL, this makes perfect sense.
If you don't, then I seriously suggest you learn.
Once again, that's http://nehe.gamedev.net
And if you have any more questions, or this didn't make sense, please say so. I wouldn't want to steer you away. ^^
Anyway, I'm going to assume by the fact that you don't sound like a complete n00b that you're at least using OpenGL by now. No? If not, you really should learn as soon as you possibly can. I suggest http://nehe.gamedev.net for tutorials and stuff. Just start at lesson1 and work your way through. It's how I learned. ^^
Anyway, assuming you are using OpenGL, you'll have two images, correct?
One where the hands are even...
And one where one of the hands is in front, the other is in back.
Frame One:
glBindTexture(GL_TEXTURE_2D, FirstImage.texID);
glTexCoord2d(0,0); glVertex3f(0,0,0);
glTexCoord2d(1,0); glVertex3f(10,0,0);
glTexCoord2d(1,1); glVertex3f(10,10,0);
glTexCoord2d(0,1); glVertex3f(0,10,0);
Frame Two:
glBindTexture(GL_TEXTURE_2D, SecondImage.texID);
glTexCoord2d(0,0); glVertex3f(0,0,0);
glTexCoord2d(1,0); glVertex3f(10,0,0);
glTexCoord2d(1,1); glVertex3f(10,10,0);
glTexCoord2d(0,1); glVertex3f(0,10,0);
Frame One:
glBindTexture(GL_TEXTURE_2D, FirstImage.texID);
glTexCoord2d(0,0); glVertex3f(0,0,0);
glTexCoord2d(1,0); glVertex3f(10,0,0);
glTexCoord2d(1,1); glVertex3f(10,10,0);
glTexCoord2d(0,1); glVertex3f(0,10,0);
Frame Three:
glBindTexture(GL_TEXTURE_2D, SecondImage.texID);
glTexCoord2d(1,0); glVertex3f(0,0,0);
glTexCoord2d(0,0); glVertex3f(10,0,0);
glTexCoord2d(0,1); glVertex3f(10,10,0);
glTexCoord2d(1,1); glVertex3f(0,10,0);
Just switching the U coordinates 1<->0 is all it takes to flip the image horizontally. You could do something similar by switching the V coordinates 1<->0 to flip it vertically.
Hrm...
Okay, if you know OpenGL, this makes perfect sense.
If you don't, then I seriously suggest you learn.
Once again, that's http://nehe.gamedev.net
And if you have any more questions, or this didn't make sense, please say so. I wouldn't want to steer you away. ^^
Oh, and if I can make one more suggestion. It really would be worth your time to just go ahead and go to paint, flip the image horizontally, and save it as another image.
If you do that, then you can load your images into an array and do something like this:
glTexture DudeWalking[4];
int Frame;
void Init()
{
char filename[256];
for(int a = 0; a < 4; a++)
int r = sprintf(filename, "Files//Sprites//DudeWalking%d.bmp", a);
DudeWalking[a].LoadTexture(filename);
}
}
void Render()
{
glBindTexture(GL_TEXTURE_2D, DudeWalking[frame].texID);
glTexCoord2d(0,0); glVertex3f(0,0,0);
glTexCoord2d(1,0); glVertex3f(10,0,0);
glTexCoord2d(1,1); glVertex3f(10,10,0);
glTexCoord2d(0,1); glVertex3f(0,10,0);
frame = (frame + 1) % 4
}
If you do that, then you can load your images into an array and do something like this:
glTexture DudeWalking[4];
int Frame;
void Init()
{
char filename[256];
for(int a = 0; a < 4; a++)
int r = sprintf(filename, "Files//Sprites//DudeWalking%d.bmp", a);
DudeWalking[a].LoadTexture(filename);
}
}
void Render()
{
glBindTexture(GL_TEXTURE_2D, DudeWalking[frame].texID);
glTexCoord2d(0,0); glVertex3f(0,0,0);
glTexCoord2d(1,0); glVertex3f(10,0,0);
glTexCoord2d(1,1); glVertex3f(10,10,0);
glTexCoord2d(0,1); glVertex3f(0,10,0);
frame = (frame + 1) % 4
}
OK I'll reword it then. I know how to program everything, everything is nearly done except the pictures cause I don't know how to draw. Now I wanna make a walk cycle, but am having troubles making frame #2(as in drawing the picture in a general paint program, not making a program that draws it to the screen).
So in short I'm looking for suggestions on how to do frame #2(with 1 hand forward, 1 back, and the feet the opposite way.)
So in short I'm looking for suggestions on how to do frame #2(with 1 hand forward, 1 back, and the feet the opposite way.)
AMP Minibowling - Free asynchronous multiplayer mobile minigolf+bowling
[twitter]eedok[/twitter]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement