Zombie: Difference between revisions

Content added Content deleted
No edit summary
No edit summary
Line 1: Line 1:
{{Infobox Monster|img=Zombie.png|hp=1|points=100}}
{{Infobox Monster|img=Zombie.png|hp=1|points=100}}
{{Infobox Entity|entity_pointer=$81:87F8 (normal)<br/>$81:88CA (hard)}}
{{Infobox Entity|entity_pointer=$81:87F8 (normal)<br/>$81:88CA (hard)}}
The zombie is a [[respawning monster]]. There are two different types of zombies: normal and hard. They behave mostly the same, but there are slight differences that make the hard version more aggressive.
The zombie is a [[respawning monster]].


== Behavior ==
== Behavior ==
Line 11: Line 11:


{{BPMN_embed|BPMN:Zombie state diagram}}
{{BPMN_embed|BPMN:Zombie state diagram}}

Zombies will despawn if they are a distance of 208 pixels or more on a single axis from the closest player, and are not within target range of any targetable sprites. The SNES screen has a width of 256 pixels, so this means it is possible for a zombie to despawn while still on screen if all players are on the very left or right of the screen and the zombie is on the opposite side.

== Differences in hard version ==

[[File:Zombie follow wall comparison.gif|frame|Normal (left) vs. hard (right) targeting through a wall]]

* Start targeting at distance of 159 pixels (instead of 64 pixels for normal). They continue targeting while there is a target within 179 pixels (instead of 69 pixels for normal).
* Moves at a speed of 1 px/frame when wandering and following wall (instead of 0.5 px/frame for normal).
* Position update logic is different when targeting. When targeting through a wall, normal zombies will get stuck, but the hard version will still follow along the wall.
* The angle to rotate when following a wall is stored in a variable instead of being hardcoded. However, this variable is never initialized, so it will retain whatever value happened to be in RAM previously. This generally results in the zombie sticking to the wall instead of following it.
* Will switch to the wandering state if they are unable to move towards the target when targeting (because there is a wall in the way). The zombie will still likely be within target range, so it will usually immediately switch back to targeting, resulting in the zombie turning in place spastically.

== Animation ==

Zombies have a four frame animation cycle, with 8 frames in between each animation frame. There is a separate set of animation frames for each of the 4 orthogonal directions, chosen based on which direction the zombie is moving. If the zombie is moving diagonal, it uses the left or right animation.

== RAM map ==

=== Entity arguments ===

{| class="wikitable"
|-
! Address !! Length !! [[Data types|Type]] !! Description
|-
| $00 || 2 || int16 || X position
|-
| $02 || 2 || int16 || Y position
|}

=== Entity memory ===

{| class="wikitable"
|-
! Address !! Length !! [[Data types|Type]] !! Description
|-
| $08 || 2 || pointer16 || Pointer to sprite
|-
| $0A || 2 || uint16 || Number of 2-frame cycles until next animation frame
|-
| $0C || 2 || uint16 x2 || Current animation frame
|-
| $0E || 2 || direction x2 || Current direction
|-
| $10 || 2 || direction x2 || New direction
|-
| $12 || 2 || uint16 || Death status. 0 = alive, 0xF5F5 = killed, other = despawned
|-
| $14 || 2 || pointer16 || Current state subroutine pointer
|-
| $16 || 2 || int16 || X position
|-
| $18 || 2 || int16 || Y position
|-
| $1A || 2 || int16 || New X position
|-
| $1C || 2 || int16 || New Y position
|-
| $1E || 2 || int16 0-based || Health
|-
| $20 || 2 || direction x4 || Direction to target
|-
| $22 || 2 || sprite type || Type of sprite collided with
|-
| $24 || 2 || unused || Value is set and used, but appears to have no effect (hard only)
|-
| $26 || 2 || int16 || Temp X position (hard only)
|-
| $28 || 2 || int16 || Temp Y position (hard only)
|-
| $2A || 2 || uint16 || Number of times left to move when targeting (hard only)
|-
| $2C || 2 || int16 || Amount to rotate when following wall (hard only)
|-
| $2E || 2 || pointer16 || Pointer to target sprite (not used) (easy only)
|- class="breakrow"
| $7E || 2 || unused || Value is set but not used
|}


[[Category:Respawning monster]]
[[Category:Respawning monster]]