Martian

From ZAMN Hacking
Revision as of 21:11, 30 April 2024 by Piranhaplant (talk | contribs)
Monster data
HP 1
Points 200
Entity data
Entity pointer $81:99DF (normal)
$81:9A3E (top of screen)

The martian is a respawning monster. There are two different types of martians: normal and top of screen.

Behavior

Normal martian

Normal martian behavior areas.
Red: move away
Yellow: Line up
Pink: Move towards
Blue: Keep previous direction
Outside all colors: Despawn
Light area in center is the size of the screen

Normal martians will try to stay about 70 pixels away from a target, while lining themselves up for a shot on the target. However, the relatively large amount of time between direction updates means that they generally just dart around diagonally in the vicinity of the target.

  • Every frame, attempt to shoot at a player or victim if there is one within 8 pixels of the martian on a single axis. Every 61 attempts, a shot will actually be fired.
    • When a shot is fired, stand in place for 12 frames.
  • Every 61 frames (about once per second) update the movement direction:
    • If the nearest target is less than 60 pixels away, move away from the target.
    • If the nearest target is between 60 and 79 pixels away, move in the direction of the shortest distance to line up with the target on a single axis.
    • If the nearest target is between 80 and 223 pixels away, move towards the target.
    • If none of the above is true and there is no player within 207 pixels on a single axis, then despawn.
  • Move in the current direction at a speed of 1.5 px/frame.

Note that martians will target decoys, but they will not attempt to shoot at them.

Top of screen martian

Top of screen martians will move side to side above a target, trying to maintain about 108 pixels of space vertically. Upon spawning, they will set their Y position to 8 pixels below the top of the screen.

  • If there is no player within 207 pixels on a single axis, despawn.
  • If there is a player above the martian, convert into a normal martian.
  • Every frame, attempt to shoot at a player or victim if there is one within 8 pixels of the martian on a single axis. Every 61 attempts, a shot will actually be fired.
    • If a shot was not attempted in this way, randomly attempt to shoot down with probability 30/256 (about 11.72%).
    • When a shot is fired, stand in place for 12 frames.
  • Every 33 frames, update horizontal movement direction:
    • If the nearest target is less than 20 pixels away, move away from the target.
    • If the nearest target is 20 pixels or more away, move towards the target.
  • Move based on the current horizontal movement direction:
    • If the nearest target is less than 96 pixels below the martian, move up-left or up-right at a speed of 3 px/frame.
    • If the nearest target is between 96 and 119 pixels below the martian, move left or right at a speed of 1.5 px/frame.
    • If the nearest target is 120 pixels or more below the martian, move down-left or down-right at a speed of 3 px/frame.