In this section, we will introduce the left hand. The left hand will be used to throw the grenade. So, first we will need to create a linear animation of the left hand. However, this time, we will not interpolate over position but over rotation. Then, we will chain animations. When the animation of the left hand ends, we will start the animation of the grenade.
We want to throw the grenade when the Enter key is pressed. Let's first go over the class to handle the animation of the left hand.
Open the LeftHand.js
file from the primitive/game
folder of the code bundle in your text editor.
The LeftHand
class also inherits StageObject
. We have defined some new properties (rotations
, counter
, and grenadeCallBack
). The rotations
array holds the angles that we need to interpolate on. The integer counter
maintains number of times the update
function has been invoked. The variable grenadeCallback
, holds...