# Option joystick-playing Controls walk and special-action with a joystick ## State Machine ## State stand
If that state is active,
> | The basic behavior stand is executed.
The decision tree:
Pseudo code of the decision tree:
if ( | joystick-data.direct-special-action | ) | // direct special-action - button directly mapped by server
{
transition-to-state(kick);
}
else
{
if ( |
( | abs( joystick-data.x ) > 0.2 | )
( | abs( joystick-data.y ) > 0.2 | )
( | abs( joystick-data.z ) > 0.2 | )
| ) | // any significant value on one of the three axis
{
transition-to-state(walk);
}
else
{
transition-to-state(stand);
}
}
## State walk
If that state is active,
> | The basic behavior walk is executed. Parameters:
| walk.type | = | walk-type.normal ;
| walk.speed-x | = | ((joystick-data.x * joystick-data.x) * (((sgn( joystick-data.x ) + 1) * 250) - 150)) ;
| walk.speed-y | = | (((joystick-data.y * joystick-data.y) * sgn( joystick-data.y )) * 100) ;
| walk.rotation-speed | = | (((joystick-data.z * joystick-data.z) * sgn( joystick-data.z )) * 100) ;
The decision tree:
Pseudo code of the decision tree:
if ( | joystick-data.direct-special-action | ) | // direct special-action - button directly mapped by server
{
transition-to-state(kick);
}
else
{
if ( |
( | abs( joystick-data.x ) < 0.2 | )
&& |
( | abs( joystick-data.y ) < 0.2 | )
&& |
( | abs( joystick-data.z ) < 0.2 | )
| ) | // no significant value on any of the three axis
{
transition-to-state(stand);
}
else
{
transition-to-state(walk);
}
}
## State kick
If that state is active,
> | The basic behavior special-action is executed. Parameters:
| special-action-id | = | joystick-data.special-action-id ;
The decision tree:
Pseudo code of the decision tree:
if ( | joystick-data.direct-special-action | ) | // direct special-action - button directly mapped by server
{
transition-to-state(kick);
}
else
{
if ( | executed-motion-request.motion-type == special-action | ) | // kick in progress
{
transition-to-state(kick-in-progress);
}
else
{
transition-to-state(kick);
}
}
## State kick-in-progress
If that state is active,
> | The basic behavior stand is executed.
The decision tree:
Pseudo code of the decision tree:
if ( | joystick-data.direct-special-action | ) | // direct special-action - button directly mapped by server
{
transition-to-state(kick);
}
else
{
if ( |
!( | executed-motion-request.motion-type == special-action | )
| ) | // kick finished
{
transition-to-state(stand);
}
else
{
transition-to-state(kick-in-progress);
}
}