A_BatSpawn

From ZDoom Wiki
Jump to navigation Jump to search

A_BatSpawn
(no parameters) This is used in order to spawn a Bat at a regular interval.

This function decreases the calling actor's special1 field. If it doesn't become negative, then the function stops without doing anything else, and no bat is spawned.

If special1 is reduced to a negative value, then a bat a spawned and fired roughly in the direction of the calling actor's angle. The calling actor's second parameter (args[1]) is used as a byte angle to determine the acceptable spread.

The bat is treated as a projectile: its target field is the calling actor.

The bat's special2 field is set to eight times the calling actor's fourth parameter (args[3]). Its first parameter (args[0] is set to a random value between 0 and 63, and its fifth parameter (args[4]) is set to the calling actor's fifth parameter. Those values are used by A_BatMove, which is expected to be called every two tics.

This codepointer is restricted to BatSpawner and derived classes.