total n00b here, major help needed
total n00b here, major help needed
I have an animated character, and i want to make it so when you press W on your keyboard, the character moves forward, while displaying a running animation, and when no button are presssed, an idle animation is displayed. I know i must know C++, but i looked at some tutorials, and am totally confused, so if anybody could give me an example or something, i could teach myself how
-
- Posts: 61
- Joined: Sun May 08, 2005 11:30 am
Before learning the tutorials, you should learn C++. Find some good books about C++ programming (in general, not only game programming) and after some time (can be long), once you know the syntax well and already some small programs, then you can look more in details at the tutorials. Otherwise, you'll get totally lost if you don't know the language itself.
-
- Posts: 47
- Joined: Wed Feb 01, 2006 8:09 pm
- Location: Wroclaw
- Contact:
The problem's not that complicated since I managed to solve it by myself.
Create your own entities that the scene nodes will represent and add member variables to describe their states. Example taken from my own code snippet:
"This" refers to the entity. "Model" is the scene node that serves as its representation. To reverse the process, add a method for stopping entity's movement:
... and voila! You have an animated character that blindly obeys your merciless orders. No worry, the best's still ahead - namely creating editor to place the actual content on the map or figuring out pathfinding algorithms. May the force be with you!
Create your own entities that the scene nodes will represent and add member variables to describe their states. Example taken from my own code snippet:
Code: Select all
if (this->state!=STATE_WALK)
{
this->state=STATE_WALK;
this->model->setMD2Animation("run");
this->model->setLoopMode(true);
}
Code: Select all
void Character::Stop()
{
this->state=STATE_STAND;
this->model->setMD2Animation("stand");
}