A_BunnyHop is an action that checks if the actor is on the ground, and if so, makes the actor jump up and forward. Var1 specifies the strength of the upward thrust, Var2 specifies the strength of the forward thrust. In SRB2, this action was originally used by the bunnies (after which it is named) and chickens that spawn out of destroyed enemies. While they do not use the action anymore, it is currently used by the Robo-Hood and the Penguinator enemies.
Code – A_BunnyHop
|
|
// Function: A_BunnyHop
//
// Description: Makes object hop like a bunny.
//
// var1 = jump strength
// var2 = horizontal movement
//
void A_BunnyHop(mobj_t *actor)
{
INT32 locvar1 = var1;
INT32 locvar2 = var2;
#ifdef HAVE_BLUA
if (LUA_CallAction("A_BunnyHop", actor))
return;
#endif
if (((actor->eflags & MFE_VERTICALFLIP) && actor->z + actor->height >= actor->ceilingz)
|| (!(actor->eflags & MFE_VERTICALFLIP) && actor->z <= actor->floorz))
{
P_SetObjectMomZ(actor, locvar1*FRACUNIT, false);
P_InstaThrust(actor, actor->angle, FixedMul(locvar2*FRACUNIT, actor->scale)); // Launch the hopping action! PHOOM!!
}
}
|
|