Bat

From ZAMN Hacking
Entity data
Entity pointer $82:F03E

The bat is an entity that is spawned by vampires.

Behavior[edit]

A bat starts out moving in a given direction specified in the entity arguments. The initial velocity of the bat is 6 px/frame in this direction. If the direction is diagonal, the velocity is 6 px/frame on both axes. Every frame, the bat will accelerate towards the nearest target at a rate of 1 px/frame2, but its speed will not exceed 6 px/frame. After the acceleration is applied, then the position is updated based on the current velocity.

Every 3 frames the bat will switch to the next animation frame. There are 2 different sprites that it alternates between.

A bat will die if any of the following conditions are met:

  • It contacts a tile that is solid to weapons
  • It touches a player, victim, or any weapon shot
  • It has been alive for 131 frames

Once the bat dies, it plays a 32 frame death animation, then the entity is destroyed.

RAM map[edit]

Entity arguments[edit]

Address Length Type Description
$00 2 int16 X position
$02 2 int16 Y position
$04 2 direction x2 Direction

Entity memory[edit]

Address Length Type Description
$08 2 pointer16 Pointer to sprite
$0A 2 int16 X position
$0C 2 int16 Y position
$0E 2 int16 X velocity
$10 2 int16 Y velocity
$12 2 unused Value is set, but never used
$14 2 boolean Dead
$16 2 uint16 Low bit is the current animation frame
$18 2 uint16 0-based Number of frames until the next animation frame
$1A 2 uint16 0-based Number of frames until death