Fire: Difference between revisions
Content deleted Content added
Piranhaplant (talk | contribs) No edit summary |
Piranhaplant (talk | contribs) No edit summary |
||
(6 intermediate revisions by the same user not shown) | |||
Line 15:
{| 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
|}
Line 30:
{| 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 header}}
main() {
{{RAM name|$7E:00DE}} += 8
init()
this.health = 5
{{ROM name|$80:8475}}(collisionHandler)
while (this.collidedSpriteType == 0 || (this.collidedSpriteType != OFF_SCREEN && this.health >= 0)) {
this.collidedSpriteType = 0
{{ROM name|$80:8353}}(2)
this.cyclesUntilAnimUpdate -= 1
if (this.cyclesUntilAnimUpdate < 0) {
this.cyclesUntilAnimUpdate = 2
this.animationFrame = (this.animationFrame + 1) % 4
this.sprite.tileData.lowBytes = animation[this.animationFrame]
this.sprite.tileData.bank = 0x8F
this.sprite.type = 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 ||
weaponType == SODA_POP_CANS ||
weaponType == SQUIRT_GUN ||
weaponType == 0x65) {
this.health -= 1
return true
}
if (weaponType == OFF_SCREEN) {
return true
}
return false
}
{{Pseudocode footer}}
[[Category:One-shot monster]]
|