• Register
Post tutorial Report RSS Dynamic Character Blink (on idle)

A few days ago (or so) the dev lead asked me to add dynamic blinking to the main character for the idle character animations. He wanted the character to blink at random intervals instead of at the end of each idle animation loop cycle. The solution ended up being pretty simple...

Posted by on - Basic Client Side Coding


First I started off by attaching the blink animation to the end of each of the idle animations & then I edited the first frame of each of the idle animations & created an execute a script action part containing...

if math.random(20) < 13 then
 ActiveAnimations["animation_name"].AnimationLastFrame = 16
else
 ActiveAnimations["animation_name"].AnimationLastFrame = 21
end

"animation_name" would be the name of the animation (I added a generic name to the code block). Also the number values are the amount of frames of the animation without & with the blink part of the animation. In this case frames 1-16 were the idle part of the animation & frames 17-21 was the blink part.

The little script above randomly generates a number between 1 & 20 & if the number is less than 13 then it will only play the idle part of the animation but if it equals 13 or more then it will play the idle part of the animation & then the blink part of the animation. This means that there is a 7 out of 20 chance that the character will blink at the end of the idle animations loop cycle.

In Visionaire Studio we can force which animation frames of an animation can be played by defining the initial & end frame using AnimationFirstFrame & AnimationLastFrame.

Pretty straightforward, no?

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.

Tutorial
Browse
Tutorials
Report
Report
Share
Related Games
A Little Less Desperation
A Little Less Desperation Point and Click
Related Engines
Visionaire Studio
Visionaire Studio Commercial
Related Groups
Deaf Bird Entertainment
Deaf Bird Entertainment Developer & Publisher