Prev: B963 Up: Map Next: B99B
B979: Apply Gravity And Move
Applies gravity to an object, then moves it by its speeds, limited to where it is able to go by BlockMovement, which changes the speeds. ApplyGravityAndMove_AddSpeeds only moves the object.
Input
IX The address of the object
Speed the fall, then stay clear of walls and other objects.
ApplyGravityAndMove B979 DEC (IX+$0B) Reduce the speed along z by one, which is gravity.
ApplyGravityAndMove_Move B97C CALL BlockMovement Call BlockMovement to move the object.
This entry point is used by the routine at MovePlayer.
Add the speeds to the position.
ApplyGravityAndMove_AddSpeeds B97F LD A,(IX+$01) Fetch the x position of the object.
B982 ADD A,(IX+$09) Add the speed along the x axis.
B985 LD (IX+$01),A Set the new x position.
B988 LD A,(IX+$02) Fetch the y position of the object.
B98B ADD A,(IX+$0A) Add the speed along the y axis.
B98E LD (IX+$02),A Set the new y position.
B991 LD A,(IX+$03) Fetch the z position of the object.
B994 ADD A,(IX+$0B) Add the speed along the z axis.
B997 LD (IX+$03),A Set the new z position.
B99A RET Return.
View the equivalent code in;
Prev: B963 Up: Map Next: B99B