Prev: 35903 Up: Map Next: 36018
35928: Accelerate Towards Player
Used by the routine at ProcessObjectFlags.
Sets the acceleration of an object so that it heads towards the player. Objects of type 29 and 30 are left alone.
Input
IX Address of the object
AccelerateTowardsPlayer 35928 LD A,(IX+0) Fetch the type of the object.
35931 CP 29 Is it 29?
35933 RET Z Return if so.
35934 CP 30 Is it 30?
35936 RET Z Return if so.
35937 LD A,(23601) Fetch the value from ContactFlags.
35940 AND %10000000 Keep bit 7.
35942 RET NZ Return if it is set.
This entry point is used by the routine at SpawnEnemy.
AccelerateTowardsPlayer_Horizontal 35943 LD (IX+11),0 Set the horizontal acceleration to 32.
35947 LD (IX+12),32
35951 LD A,(52823) Fetch the map column of the player from MapPosition.
35954 CP (IX+1) Compare it with the map column of the object.
35957 JR Z,AccelerateTowardsPlayer_Stop Jump to AccelerateTowardsPlayer_Stop if they are the same.
35959 LD (IX+12),224 Otherwise set the horizontal acceleration to 65504.
35963 LD (IX+11),255
AccelerateTowardsPlayer_Stop 35967 XOR A Clear the speeds of the object and its vertical acceleration.
35968 LD (IX+9),A
35971 LD (IX+10),A
35974 LD (IX+14),A
35977 LD (IX+15),A
35980 LD A,(52824) Fetch the map zone of the player from 52824.
35983 CP (IX+4) Compare it with the map zone of the object.
35986 LD A,(52806) Fetch the vertical position of the player from PositionDown.
35989 JR NZ,AccelerateTowardsPlayer_Other Jump to AccelerateTowardsPlayer_Other if the zones are different.
35991 CP (IX+5) Compare it with the vertical position of the object.
35994 RET C Return if it is lower.
35995 LD (IX+14),0 Set the vertical acceleration to 32.
35999 LD (IX+15),32
36003 RET Return.
AccelerateTowardsPlayer_Other 36004 CP (IX+5) Compare the vertical position of the player with that of the object.
36007 RET NC Return if it is not lower.
36008 LD (IX+14),255 Set the vertical acceleration to 65504.
36012 LD (IX+15),224
36016 RET Return.
36017 DEFB 0
Prev: 35903 Up: Map Next: 36018