Mummy

From ZAMN Hacking
Revision as of 20:17, 13 July 2024 by Piranhaplant (talk | contribs)
Monster data
HP 5
Points 100
Special {{{special}}}
Resists {{{resists}}}
Weak to {{{weak_to}}}
Entity data
Entity pointer $81:8C17

The mummy is a respawning monster.

Behavior

Mummies share most of their code with the hard version of zombies, and thus behave identically. The only differences are their starting health and graphics.

RAM map

See Zombie#RAM map.

Pseudocode

updateAnimation() {
	this.cyclesUntilAnimUpdate -= 1
	if (this.cyclesUntilAnimUpdate == 0) {
		this.cyclesUntilAnimUpdate = 4
		this.animationFrame = (this.animationFrame + 1) % 4

		this.sprite.tileData.lowBytes = animations[this.direction][this.animationFrame]
		this.sprite.tileData.bank = 0x90
		if (this.direction < DOWN_LEFT) {
			this.sprite.flipX = false
		} else {
			this.sprite.flipX = true
		}
	}
}

animations = {
	{ 0xE1D4,  0xE1FD,  0xE226,  0xE24F }, 
	{ 0xE278,  0xE2A1,  0xE2CA,  0xE2F3 }, 
	{ 0xE118,  0xE149,  0xE172,  0xE1A3 }, 
	{ 0xE118,  0xE149,  0xE172,  0xE1A3 }, 
	{ 0xE118,  0xE149,  0xE172,  0xE1A3 }, 
	{ 0xE1D4,  0xE1FD,  0xE226,  0xE24F }, 
	{ 0xE118,  0xE149,  0xE172,  0xE1A3 }, 
	{ 0xE118,  0xE149,  0xE172,  0xE1A3 }, 
	{ 0xE118,  0xE149,  0xE172,  0xE1A3 }
}

init() {
	createMonsterSprite()
	this.animationFrame = 0
	this.freezeTimer = 0
	this.x = args.x
	this.sprite.x = args.x
	this.sprite.z = 0
	this.y = args.y
	this.sprite.y = args.y
	this.sprite.tileData = $90:E118
	this.sprite.alternatePalette = 6
	this.sprite.visible = true
}

main() {
	$7E:00DE += 0x14
	this.cyclesUntilAnimUpdate = 7
	init()
	showAnimation(this.spawnAnimation)
	this.sprite.type = MONSTER
	zombie.wanderInRandomDirection_Hard()
	this.health = 4
	this.dontTargetTimer = -1
	setCollisionHandler(zombie.collisionHandler)
	this.deathStatus = 0

	while (this.deathStatus == 0) {
		waitFrames(2)
		zombie.checkForTarget_Hard()
		this.state()
		updateAnimation()
	}

	if (this.deathStatus == 0xF5F5) {
		mummiesKilled += 1
		showMonsterDeath(this.deathAnimation, this.deathStatus, 0x90)
	}

	$7E:00DE -= 0x14
	while ($7E:00DE < 0) { }
	deleteSprite(this.sprite)
}

spawnAnimation = {
	{ 0xE31C, 14 }, { 0xE35D, 14 }, { 0xE39E, 10 }, { 0xE1D4, 6 },
	{ 0, 0 }
}

deathAnimation = {
	{ 0xDDC2, 5 }, { 0xDDDB, 5 }, { 0xDE0C, 5 }, { 0xDE3D, 5 },
	{ 0xDE66, 5 }, { 0xDE8F, 5 }, { 0xDEA8, 5 }, { 0xDEC1, 5 },
	{ 0xDED2, 5 }, { 0xDEE3, 5 }, { 0xDEF4, 5 }, { 0, 0 }
}