Clone: Difference between revisions

From ZAMN Hacking
Content added Content deleted
No edit summary
No edit summary
Line 10: Line 10:


Normal clones can be in one of two states:
Normal clones can be in one of two states:
* '''Targeting:''' The clone will move towards the nearest player at a speed of 0.75 px/frame. This only targets players, not victims or [[decoys]]. If there is no player within 239 pixels on a single axis, then the clone will despawn.
* '''Targeting:''' Move towards the nearest player at a speed of 0.75 px/frame. This only targets players, not victims or [[decoys]]. If there is no player within 239 pixels on a single axis while in this state, then the clone will despawn.
* '''Mimicking:''' The clone will move in the direction of the cloned player's d-pad input at a speed of 0.75 px/frame.
* '''Mimicking:''' Move in the direction of the cloned player's d-pad input at a speed of 0.75 px/frame. Stand still if the player is not pressing any direction on the d-pad.


Clones start in the targeting state, but will switch to the mimicking state after 1 frame. Afterwards, the clone will repeatedly switch to the opposite state after a random amount of time between 1 and 255 frames (about 4.25 seconds).
Clones start in the targeting state, but will switch to the mimicking state after 1 frame. Afterwards, the clone will repeatedly switch to the opposite state after a random amount of time between 1 and 255 frames (about 4.25 seconds).
Line 23: Line 23:
== Animation ==
== Animation ==


Clones have a 4 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 clone is moving. There is also a separate set of animations for Zeke and Julie, chosen based on the character of the player who is being cloned. If the clone is moving diagonal, it uses the left or right animation. If the clone is not moving, it uses a single right-facing sprite for all 4 animation frames.
Clones have a 4 frame animation cycle, with 7 frames 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 clone is moving. There is also a separate set of animations for Zeke and Julie, chosen based on the character of the player who is being cloned. If the clone is moving diagonal, it uses the left or right animation. If the clone is not moving, it uses a single right-facing sprite for all 4 animation frames.


== Bugs ==
== Bugs ==


* [[Fire extinguisher|Freezing]] or [[Bubble gun|bubbling]] a clone, then letting it despawn will count as killing it. This is because the logic for if a clone was killed or not checks if it was ever hit by a weapon, not if it lost all its HP.
* [[Fire extinguisher|Freezing]] or [[Bubble gun|bubbling]] a clone, then letting it despawn will count as killing it. This is because the logic that determines if a clone was killed or not checks if it was ever hit by a weapon, not if it lost all its HP.
* The normal clone can randomly get a value of 0 for the amount of time in between state changes. If this happens, the value will roll over and it will take a full 65536 frames (about 18.2 minutes) for it to change states again.
* The normal clone can randomly get a value of 0 for the amount of time in between state changes. If this happens, the value will underflow and it will take a full 65536 frames (about 18.2 minutes) for it to change states again.

== 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 frames until next animation frame
|-
| $0C || 2 || uint16 || Current animation frame (x2 during spawn animation)
|-
| $0E || 2 || direction || Current direction
|-
| $10 || 2 || unused || Unused
|-
| $12 || 2 || int16 || X position in pixels (derived from $16)
|-
| $14 || 2 || int16 || Y position in pixels (derived from $18)
|-
| $16 || 2 || int16 x4 || X position
|-
| $18 || 2 || int16 x4 || Y position
|-
| $1A || 2 || int16 || New X position in pixels
|-
| $1C || 2 || int16 || New Y position in pixels
|-
| $1E || 2 || int16 x4 || New X position
|-
| $20 || 2 || int16 x4 || New Y position
|-
| $22 || 2 || int16 0-based || Health
|-
| $24 || 2 || uint16 || Current state (0 = targeting, 1 = mimicking)
|-
| $26 || 2 || uint16 || Number of frames until state change
|-
| $28 || 2 || pointer16 || Pointer to spawn animation
|-
| $2A || 2 || pointer16 || Pointer to walking animations table
|-
| $2C || 2 || uint16 x2 || Which player is being cloned
|-
| $2E || 2 || boolean || Dead
|-
| $30 || 2 || sprite type || Type of weapon shot sprite collided with
|- class="breakrow"
| $7E || 2 || unused || Value is set but not used
|}


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

Revision as of 23:48, 19 April 2024

Monster data
HP 1
Points 20
Entity data
Entity pointer $81:8E89 (normal)
$81:8F1F (hard)

The clone is a respawning monster. There are two different types of clones: normal and hard.

Cloning behavior

Both types of clones start by picking a player to clone. If there is only one player in the game, that player is selected. If there are two players in the game, one of them is selected at random. If there are no players left in the game, the clone will not spawn.

Normal clone

Normal clones can be in one of two states:

  • Targeting: Move towards the nearest player at a speed of 0.75 px/frame. This only targets players, not victims or decoys. If there is no player within 239 pixels on a single axis while in this state, then the clone will despawn.
  • Mimicking: Move in the direction of the cloned player's d-pad input at a speed of 0.75 px/frame. Stand still if the player is not pressing any direction on the d-pad.

Clones start in the targeting state, but will switch to the mimicking state after 1 frame. Afterwards, the clone will repeatedly switch to the opposite state after a random amount of time between 1 and 255 frames (about 4.25 seconds).

Hard clone

Hard clones always target the nearest player. They move at a speed of 1.5 px/frame, twice as fast as the normal clone. They will also despawn if there is no player within 239 pixels on a single axis.

Animation

Clones have a 4 frame animation cycle, with 7 frames 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 clone is moving. There is also a separate set of animations for Zeke and Julie, chosen based on the character of the player who is being cloned. If the clone is moving diagonal, it uses the left or right animation. If the clone is not moving, it uses a single right-facing sprite for all 4 animation frames.

Bugs

  • Freezing or bubbling a clone, then letting it despawn will count as killing it. This is because the logic that determines if a clone was killed or not checks if it was ever hit by a weapon, not if it lost all its HP.
  • The normal clone can randomly get a value of 0 for the amount of time in between state changes. If this happens, the value will underflow and it will take a full 65536 frames (about 18.2 minutes) for it to change states again.

RAM map

Entity arguments

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

Entity memory

Address Length Type Description
$08 2 pointer16 Pointer to sprite
$0A 2 uint16 Number of frames until next animation frame
$0C 2 uint16 Current animation frame (x2 during spawn animation)
$0E 2 direction Current direction
$10 2 unused Unused
$12 2 int16 X position in pixels (derived from $16)
$14 2 int16 Y position in pixels (derived from $18)
$16 2 int16 x4 X position
$18 2 int16 x4 Y position
$1A 2 int16 New X position in pixels
$1C 2 int16 New Y position in pixels
$1E 2 int16 x4 New X position
$20 2 int16 x4 New Y position
$22 2 int16 0-based Health
$24 2 uint16 Current state (0 = targeting, 1 = mimicking)
$26 2 uint16 Number of frames until state change
$28 2 pointer16 Pointer to spawn animation
$2A 2 pointer16 Pointer to walking animations table
$2C 2 uint16 x2 Which player is being cloned
$2E 2 boolean Dead
$30 2 sprite type Type of weapon shot sprite collided with
$7E 2 unused Value is set but not used