Otolone
Member
|
[SOLVED]Help on understanding animation (tutorials #12)
Hi there.
I do not understand how these lines of code can cause the character to
dodge, crouch, walk, and jump
input.dodge = Kb.bd(KB_D)-Kb.bd(KB_A);
input.crouch= Kb.b (KB_LSHIFT);
input.walk = Kb.b (KB_LCTRL );
input.jump =(Kb.bp(KB_SPACE ) ? 3.5 : 0);
What has been done in the Object Editor for OBJ_CHR so that these animations are executed?
Also pressing down the enter key executes the "attack" animation only once
if(Kb.bp(KB_ENTER)) // on enter pressed
attack.set(skel, UID(4036032190, 1277766898, 1630466228, 321593117));
// initialize "right-hand swing to left direction" attack animation
How can you cause the animation to loop when you press and hold down the enter key?
Thanks in advance.
The Player class is below
class Player : Game.Chr
{
Motion attack;
virtual void animate() // extend skeleton animation
{
super.animate(); // call default animations
skel.animate(attack, true);
}
virtual bool update()
{
if(action)
{
if(Kb.b(KB_W) || Kb.b(KB_S) || Kb.b(KB_A) || Kb.b(KB_D) || Kb.b(KB_Q) || Kb.b(KB_E))actionBreak();
}
if(!action)
{
// turn & move
// some code here
// dodge, crouch, walk, jump
input.dodge = Kb.bd(KB_D)-Kb.bd(KB_A);
input.crouch= Kb.b (KB_LSHIFT);
input.walk = Kb.b (KB_LCTRL );
input.jump =(Kb.bp(KB_SPACE ) ? 3.5 : 0);
// mouse turn
some code here
}
// update animation
{
if(Kb.bp(KB_ENTER)) // on enter pressed
attack.set(skel, UID(4036032190, 1277766898, 1630466228, 321593117)); // initialize "right-hand swing to left direction" attack animation
attack.updateAuto(3, 3, 1); // update attack animation motion
}
return super.update();
}
//more code here
}
(This post was last modified: 10-15-2017 04:50 PM by Otolone.)
|
|
10-12-2017 03:52 PM |
|
Esenthel
Administrator
|
RE: Help on understanding animation (tutorials #12)
|
|
10-12-2017 09:40 PM |
|