From ZDoom Wiki
Jump to navigation Jump to search

A_WeaponOffset [(float x [, float y [, int flags]]])]


This function can only be called on weapons. Offsets a weapon by the defined amount of x and y similar to the Offset frame keyword. This function has the following differences from the aforementioned function:

  • Offsets are floats, not integers.
  • Offsets are not lost when firing a weapon.
  • Offsets stack on top of weapon bobbing and behave independently, allowing you to use A_WeaponReady without losing offsets.
  • Specifying the default coordinates does not serve as a preservative. They are absolute.
  • Offsets can go beyond screen limitations.
  • Because this is an action function itself, Decorate expressions can be used.

This function is the same as calling A_OverlayOffset with the layer parameter set to PSPF_WEAPON.


  • x - Adjusts horizontal position based on positive (right) or negative (left) numbers. Default it 0.
  • y - Adjusts vertical position. Default is 32. Larger values lower the weapon, and vice versa.
  • flags - Flags can be combined with the | separator.
  • WOF_KEEPX - x parameter will not be used.
  • WOF_KEEPY - y parameter will not be used.
  • WOF_ADD - Adds the current x and y parameters to the current offsets instead of overriding them. Also implies interpolation (see below).
  • WOF_INTERPOLATE - Interpolates the offset between tics, smoothing out the animation.


Nuvolachalk.png Note: This article lists no examples. If you make use of this feature in your own project(s) or know of any basic examples that could be shared, please add them. This will make it easier to understand for future authors seeking assistance. Your contributions are greatly appreciated.

See Also