Evil doll axe

From ZAMN Hacking
Entity data
Entity pointer $81:B592

An evil doll axe is an entity that is created by an evil doll whenever it throws an axe.

Behavior[edit]

The axe moves at a velocity of 4 times the given input velocity per frame. In the base game, the input velocities are either 0, 1, or -1 on each axis, so it will move at a rate of 4 pixels per frame on each axis.

Axes start with 2 HP and will be instantly destroyed when they run out of health. However, axes only take damage from sprite types 7 and 8, which are a wall breaking from player punching it as a monster, and an unused type respectively. Axes will also be destroyed if they touch a background tile that is solid to weapons or if they go off screen in multiplayer. The off-screen condition does not apply in single player; they will continue to travel until they hit a solid tile or reach the edge of the level.

Animation[edit]

The axe animation has 4 different animation frames and there are 6 frames of time between each. The animation is supposed to differ slightly based on which direction the axe is moving, but there are two bugs in the implementation for this:

  1. Negative directions (up and left) are incorrectly mapped to the corresponding positive direction because the code only checks for the velocities being exactly equal to -1, but they have already been multiplied by 2 when this is checked.
  2. The "down" direction is incorrectly mapped to "right"

The result of these two bugs is that all orthogonal directions are mapped to the animation for "right", and all diagonal directions are mapped to the animation for "down-right". For orthogonal directions, this doesn't matter since they all share the same animation anyway. However, the down-left and up-left animations supposed to show the axe rotating counter-clockwise, but don't.

RAM map[edit]

Entity arguments[edit]

Address Length Type Description
$00 2 int16 X position
$02 2 int16 Y position
$04 2 int16 X velocity
$06 2 int16 Y velocity

Entity memory[edit]

Address Length Type Description
$08 2 pointer16 Pointer to sprite
$0A 2 boolean Axe has been destroyed
$0C 2 int16 0-based Health
$0E 2 pointer16 Pointer to current state subroutine (always $B5B0)
$10 2 int16 Number of frames until next animation frame
$12 2 int16 0-based Number of frames per animation frame (always 5)
$14 2 uint16 Current animation frame
$16 2 enum Animation direction
$18 2 int16 X position
$1A 2 unused Unused
$1C 2 int16 Y position
$1E 2 sprite type Type of sprite collided with
$20 2 int16 /2 X velocity
$22 2 int16 /2 Y velocity
$24 2 pointer16 Pointer to animation table (always $ADDE)

Animation Directions[edit]

Value Direction Bugged direction
0x00 Up Down
0x04 Up-right Down-right
0x08 Right Down
0x0C Down-right
0x10 Down
0x14 Down-left Down-right
0x18 Left Down
0x1C Up-left Down-right
0x20 None