Prev: 37068 Up: Map Next: 37143
37115: Check Player Touching
Used by the routines at HandlerFoodItem, HandlerPickupItem and HandlerMushroom.
Checks whether the player is touching an entity. The player is touching it when it is less than 12 pixels away on both axes.
Input
IX The entity
Output
F The carry flag is set if the player is touching the entity
CheckPlayerTouching 37115 LD A,(60051) Fetch the X position of the player from 60051.
37118 SUB (IX+3) Subtract the X position of the entity.
37121 JP P,CheckPlayerTouching_X Jump to CheckPlayerTouching_X if the result is positive.
37124 NEG Make the result positive.
CheckPlayerTouching_X 37126 CP 12 Return if the player is too far away on the X axis.
37128 RET NC
37129 LD A,(60052) Fetch the Y position of the player from 60052.
37132 SUB (IX+4) Subtract the Y position of the entity.
37135 JP P,CheckPlayerTouching_Y Jump to CheckPlayerTouching_Y if the result is positive.
37138 NEG Make the result positive.
CheckPlayerTouching_Y 37140 CP 12 Compare it with 12.
37142 RET Return.
Prev: 37068 Up: Map Next: 37143