Prev: 36390 Up: Map Next: 36567
36512: Lose Life
Takes one of the lives of the player, or ends the game if there are none left. The player is set to the vanishing sprite 103 (see HandlerPlayerVanishing), with the number of rows to erase (at offset 6) set to the height of the sprite and the sprite ID that it came from (at offset 7). If the entity is a character then the position that was saved by StoreEntity is used first.
Input
IX The entity of the character
LoseLife 36512 LD A,(24097) Fetch the number of lives from PlayerLives.
36515 AND A Test whether there are no lives left.
36516 JP Z,GameOver Jump to GameOver if there are none.
36519 DEC A Decrease the number of lives by one.
36520 LD (24097),A Update the number of lives in PlayerLives.
36523 LD A,(IX+0) Fetch the sprite ID of the entity.
36526 DEC A Subtract one to get the ID that starts at zero.
36527 CP 48 Jump to LoseLife_Character if the entity is a character.
36529 JR C,LoseLife_Character
36531 LD A,(60048) Fetch the sprite ID of the player from Player.
LoseLife_Vanish 36534 LD (60055),A Store the sprite ID of the player at offset 7.
36537 CALL FetchSprite Call FetchSprite to get the address of the sprite data.
36540 LD A,(DE) Fetch the height of the sprite.
36541 LD (60054),A Store the height of the sprite at offset 6 as the number of rows to draw.
36544 LD A,103 A=103 (the vanishing player).
36546 LD (60048),A Update the sprite ID of the player.
36549 RET Return.
Use the position and the sprite that were saved.
LoseLife_Character 36550 LD A,(24086) Fetch the previous X position from Previous_X_Position.
36553 LD (60051),A Update the X position of the player.
36556 LD A,(24087) Fetch the previous Y position from Previous_Y_Position.
36559 LD (60052),A Update the Y position of the player.
36562 LD A,(24085) Fetch the previous sprite ID from Previous_Sprite_Id.
36565 JR LoseLife_Vanish Jump to LoseLife_Vanish to start the player vanishing.
Prev: 36390 Up: Map Next: 36567