I have all the graphics ready (using DBJ87's allied marine sprites for the player,) now I started ZScripting the custom player and his states. But I don't know where to go next.
Here is my code so far (it is a script called 3DPlayerStates that will get included in the main ZScript lump):
Code: Select all
// Animation states for the player
// Heavily based on Nash's side-scroller player script
// Still trying to figure it out for myself
enum EAnimationStates
{
ANIMSTATE_SPAWN,
ANIMSTATE_STAND,
ANIMSTATE_RUN,
ANIMSTATE_JUMP,
ANIMSTATE_SHOOT,
ANIMSTATE_PAIN,
ANIMSTATE_DEATH,
ANIMSTATE_GIBBED,
TOTAL_PLAYER_STATES
}
// Player sprite to be moved and animated
extend class 3DPlayer
{
const moveThreshold = 0.05;
// Function
void Animate3DPlayer(void)
{
// Get player information
bool isOnFloor = bIsOnFloor();
double pSpeed = GetMoveSpeed();
/////////////////////////////////
// STATES //
/////////////////////////////////
int StateToPlay;
StateLabel stateName[TOTAL_PLAYER_STATES];
stateName[0] = "Spawn";
stateName[1] = "Stand";
stateName[2] = "Run";
stateName[3] = "Jump";
stateName[4] = "Shoot";
stateName[5] = "Pain";
stateName[6] = "Death";
stateName[7] = "Gibbed";
// standing still
if (isOnFloor && pSpeed <= moveThreshold)
{
StateToPlay = ANIMSTATE_STAND;
}
// running
if (isOnFloor && pSpeed > moveThreshold)
{
StateToPlay = ANIMSTATE_RUN;
}
// jump
if (!isOnFloor)
{
StateToPlay = ANIMSTATE_JUMP;
}
// set the new animation
if (oldState != StateToPlay)
{
SetStateLabel(stateName[StateToPlay]);
oldState = StateToPlay;
}
}
// Don't know where to go next
}
Any help on where to go next would be highly appreciated.


