GetActorVelY

From ZDoom Wiki
Jump to navigation Jump to search

fixed GetActorVelY (int tid)

Usage

This returns the velocity of the actor along the Y axis. Positive values means northward movement; negative values are southward.

Parameters

  • tid: TID of the actor.

Return value

The Y velocity of the actor, as a fixed point value.

Examples

This example prints the angle that the player is moving in based on x and y velocity.

script 1 ENTER
{
  int angle;
  while (TRUE)
  {
    angle = VectorAngle(GetActorVelX(0), GetActorVelY(0));
    print(f:angle);
    delay(1);
  }
}

This example prints the current speed of the player, using the FixedSqrt function.

script 1 ENTER
{
  int x, y, z, speed;
  while (TRUE)
  {
    x = GetActorVelX(0);
    y = GetActorVelY(0);
    z = GetActorVelZ(0);
    speed = FixedMul(x, x) + FixedMul(y, y) + FixedMul(z, z);
    print(f:FixedSqrt(speed));
    delay(1);
  }
}