A_Recoil


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.

A_Recoil (double xyvel)

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
  }
}

This article is issued from Zdoom. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.