Glossary script

character.js / processing pipelines

This document is deprecated / 這文件已經過期. new version / 新版本
Click to view the source file character.js
For example,
'0':function(event,K) //standing
{ switch (event) {
 case 'TU':
 {
  //...
 } break;
 
 case 'frame':
 {
  //...
 } break;
 
 case 'combo':
 {
  switch(K)
  {
  case 'run':
   switch_dir=false;
   ce.frame_trans(9);
  break;
  case 'def':
   ce.frame_trans(110);
  break;
  case 'jump':
   ce.frame_trans(210);
  break;
  case 'att':
   ce.frame_trans(Math.random()<0.5? 60:65);
  break;
  }
 } break;
}},
consider state 0 (standing).
when a combo event `run` (right-right) is received, will disable direction switching and cause a frame transition to frame 9.
when an event `att` is received, have a half-half chance transits to frame 60 or 65

In each time unit (TU), generic state update shall:
  • update the position according to velocity
  • apply friction to lower the velocity by 1px
    • only when the character is on the ground
    • only horizontal and depth component
  • apply gravity to increase the vertical velocity by 1.9px downward
    • only when not on the ground
  • not let the vertical position be under the ground level
  • if the character is moving downward and just touches the ground
    1. fire a `fall_onto_ground` event
    2. if the current state does not return a target frame, do the following:
      • if the current frame is 212, transit to frame 215
      • otherwise transist to frame 219
    3. set the vertical component of velocity to zero

Upon entering each frame, generic frame update shall:
  • display the sprite specified by the property `pic` of the current frame
  • compute new velocity by the properties `dvx`, `dvy`, `dvz`
  • set the variable `next` and `wait`
  • change the current state

0 comments:

Post a Comment