
December 8th, 2007, 02:03 PM
|
|
|
|
The best way to...
Hey,
I'm making an RPG and would like to know what the best way to change equipment and and alternate between "running and walking" and "sword in sleeve and sword out of sleeve" along with some other movments.
This is what im thinking of right now - I have a model which is a basic animation of a man walking and when the key R is pressed a new model will load with a new animation of the man running. And the same priniples apply to other movements.
Like this -
Controls -
R = Run
W= Walk
A = Arm (draw sword)
D = Dis Arm
Code:
KeyboardState keys = Keyboard.GetState();
if (keys.IsKeyDown(Keys.R))
myModel = content.Load<Model>( "Run" );
}
elseif {
(keys.IsKeyDown(Keys.W))
myModel = content.Load<Model>( "Walk" );
}
elseif {
(keys.IsKeyDown(Keys.A))
myModel = content.Load<Model>( "Arm" );
}
else {
(keys.IsKeyDown(Keys.D))
myModel = content.Load<Model>( "DisArm" );
}
Is this good, or is there a better way?
|