A_Recoil

From ZDoom Wiki
Jump to navigation Jump to search

A_Recoil (double xyvel)


Pushes the calling actor back by the specified force. Although this is designed to simulate weapon recoil it can also be used to do special monster movement and other things. If xyvel is negative it can also be used to push the actor forward instead of backward.

Note that this function does not account for the player's pitch when used on a weapon. To account for pitch, multiply xyvel by cos(pitch).

Examples

This extremely powerful shotgun throws you back when you fire it.

actor UltimaShotgun : Shotgun
{
  States
  {
  Fire:
     SHTG A 3
     SHTG A 0 A_Recoil(80)
     SHTG A 7 A_FireBullets(20, 20, 50, 5, "BulletPuff", 5) 
     SHTG A 20
     SHTG BC 5
     SHTG D 4
     SHTG CB 5
     SHTG A 3
     SHTG A 7 A_ReFire
     Goto Ready
  }
}