About Store Forum Documentation Contact
Donations:
309$/mo



Post Reply 
[SOLVED]Help on understanding animation (tutorials #12)
Author Message
Otolone Offline
Member

Post: #1
[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
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Help on understanding animation (tutorials #12)
Hi,

In the Object Editor, in the parameters, you can drag and drop the animation elements to specify which animation is used.
The actual code for animating skeletons is in the Game.Chr source code.
You can check it if you have an Engine License in the downloads:
http://www.esenthel.com/?id=store&item=1&mode=download
http://www.esenthel.com/?id=store&item=4&mode=download

If you want an animation to loop, you can't use Motion, but have to process it manually as in the tutorials.
10-12-2017 09:40 PM
Find all posts by this user Quote this message in a reply
Post Reply