A_SetAngle

From ZDoom Wiki
Jump to: navigation, search

A_SetAngle (float angle [, int flags [, int ptr]])

Usage

Sets the calling actor's or the pointed to actor's angle to angle. It can be used with the angle DECORATE variable to modify the actor's current angle.

Parameters

  • angle: the actor's new angle, in degrees.
  • flags:
    • SPF_INTERPOLATE: interpolates the view.
  • ptr: The actor to change its angle. This is an actor pointer. Default is AAPTR_DEFAULT, which corresponds to the calling actor.

Examples

This zombie spins in circles in his spawn state.

ACTOR SpinningZombieMan:ZombieMan replaces ZombieMan
{
  States
  {  
  Spawn:
    POSS ABCD 4 A_SetAngle(15+angle)
    loop
  }
}

This firing state randomly jumps the view to the left or right using A_SetAngle.

Fire:
  PISG B 0 A_GunFlash
  PISG B 0 A_Jump(128, "SpinLeft")
  PISG B 0 A_SetAngle(angle+((abs(velx)+abs(vely)+abs(velz))/10))
  goto SpinDone
SpinLeft:
  PISG B 0 A_SetAngle(angle-((abs(velx)+abs(vely)+abs(velz))/10))
SpinDone:
  PISG B 0 A_SetPitch(pitch-((abs(velx)+abs(vely)+abs(velz))/6))
  PISG B 0 A_PlaySound("Weapons/Pistol")
  PISG B 3 offset(3, 39) A_FireBullets(1, 1, -1, 12, "BulletPuff")
  PISG C 2 offset(2, 37)
  PISG D 2 offset(1, 35)
  PISG D 0 offset(0, 32)
  Goto Ready