Fire: Difference between revisions

3,482 bytes added ,  9 days ago
no edit summary
(Created page with "{{Infobox Monster|img=Fire.png|hp=6|points=0}} {{Infobox Entity|entity_pointer=$82:F25D}} Fire is a one-shot monster. Category:One-shot monster Category:Monster Category:Entity")
 
No edit summary
 
(8 intermediate revisions by the same user not shown)
Line 2:
{{Infobox Entity|entity_pointer=$82:F25D}}
Fire is a [[one-shot monster]].
 
== Behavior ==
 
Fire does not move, and thus only damages players who walk into it. It starts with 6 HP and takes one damage from each of [[fire extinguisher]], [[pop cans]], and [[squirt gun]]. Ironically, it also takes damage from [[flamethrower]], since it shares the same sprite type as pop cans. It will also take damage from the unused sprite type 0x65. If the fire goes off screen, then the entity is deleted and will be created again when it comes back on screen. This will reset the fire's HP since the entity is recreated.
 
Fire has 4 different animation frames, and there are 6 frames between each one. During the first animation frame of each cycle, the fire is set to [[sprite#Sprite types|sprite type]] 2, which will allow the player to walk through it and not be damaged. The rest of the time, it is set to sprite type 3.
 
== RAM map ==
 
=== Entity arguments ===
 
{| class="wikitable"
|-
! Address !! Length !! [[Data types|Type]] !! Name !! Description
|-
| $00 || 2 || int16 || x || X position
|-
| $02 || 2 || int16 || y || Y position
|-
| $04 || 2 || uint16 || extra || Extra data (unused)
|-
| $06 || 2 || uint16 || index || Victim/one-shot monster index
|}
 
=== Entity memory ===
 
{| class="wikitable"
|-
! Address !! Length !! [[Data types|Type]] !! Name !! Description
|-
| $08 || 2 || pointer16 || sprite || Pointer to sprite
|-
| $0A || 2 || uint16 || animationFrame || Current animation frame
|-
| $0C || 2 || int16 0-based || cyclesUntilAnimUpdate || Number of 2 frame cycles until next animation frame
|-
| $0E || 2 || unused || || Unused
|-
| $10 || 2 || int16 0-based || health || Health
|-
| $12 || 2 || int16 || x || X position
|-
| $14 || 2 || int16 || y || Y position
|-
| $16 || 2 || sprite type || collidedSpriteType || Type of sprite collided with
|}
 
== Pseudocode ==
 
main() {
{{RAM name|$7E:00DE}} += 8
this.init()
this.health = 5
{{ROM name|$80:8475}}(this.collisionHandler)
while (this.collidedSpriteType == 0 or (this.collidedSpriteType != OFF_SCREEN and this.health >= 0)) {
this.collidedSpriteType = 0
{{ROM name|$80:8353}}(2)
this.cyclesUntilAnimUpdate -= 1
if (this.cyclesUntilAnimUpdate < 0) {
this.cyclesUntilAnimUpdate = 2
this.animationFrame = (animationFrame + 1) % 4
this.sprite.tileData.lowBytes = this.animation[this.animationFrame]
this.sprite.tileData.bank = 0x8F
this.sprite.type = this.spriteTypes[this.animationFrame % 4]
}
}
if (this.collidedSpriteType != OFF_SCREEN && args.index != 0) {
{{ROM name|$81:8191}}(args.index)
}
{{RAM name|$7E:00DE}} -= 8
while ({{RAM name|$7E:00DE}} < 0) { }
{{ROM name|$80:BE41}}(this.sprite)
}
animation = { 0xD526, 0xD537, 0xD548, 0xD559 }
spriteTypes = { NO_DAMAGE_MONSTER, MONSTER, MONSTER, MONSTER }
init() {
this.sprite = {{ROM name|$80:BE0C}}()
this.sprite.x = args.x
this.x = args.x
this.sprite.z = 0
this.sprite.y = args.y
this.y = args.y
this.sprite.tileData = $8F:D526
this.sprite.entity = {{RAM name|$7E:0008}}
this.sprite.type = MONSTER
this.sprite.visible = true
this.animationFrame = 0
this.collidedSpriteType = 0
this.cyclesUntilAnimUpdate = 2
}
collisionHandler(spriteType) {
this.collidedSpriteType = spriteType
weaponType = spriteType & 0x7FFF
if (weaponType == FIRE_EXTINGUISHER or
weaponType == SODA_POP_CANS or
weaponType == SQUIRT_GUN or
weaponType == 0x65) {
this.health -= 1
return true
}
if (weaponType == OFF_SCREEN) {
return true
}
return false
}
 
[[Category:One-shot monster]]
[[Category:Monster]]
[[Category:Entity]]