castleraider
changeset 286:2b0aad2b03a3
Extended horizontal collision checking to half column resolution.
| author | David Boddie <david@boddie.org.uk> |
|---|---|
| date | Sun Mar 23 01:41:16 2014 +0100 |
| parents | 2f0e1ac0c9d0 |
| children | 3da06320a2cf |
| files | monsters.oph |
| diffstat | 1 files changed, 12 insertions(+), 13 deletions(-) [+] |
line diff
1.1 --- a/monsters.oph Sun Mar 23 00:46:29 2014 +0100 1.2 +++ b/monsters.oph Sun Mar 23 01:41:16 2014 +0100 1.3 @@ -709,22 +709,21 @@ 1.4 rts 1.5 1.6 check_monster_player: 1.7 + 1.8 + lda ($86),y ; Load monster type and dx value. 1.9 + and #monster_dx_bit 1.10 + lsr 1.11 + sta $80 1.12 + 1.13 iny 1.14 lda ($86),y ; Load monster x offset. 1.15 + asl ; Convert to half columns. 1.16 + adc $80 ; Add dx to x. 1.17 1.18 - cmp #17 1.19 - bcc check_monster_common_exit 1.20 - beq check_monster_player_bank2 1.21 - cmp #21 1.22 - bcc check_monster_player_vertical 1.23 - bcs check_monster_common_exit 1.24 - 1.25 - check_monster_player_bank2: 1.26 - lda bank_number ; x = 17,20 is only a potential hit if 1.27 - cmp #1 1.28 - beq check_monster_common_exit ; bank 2 is showing. 1.29 - 1.30 - check_monster_player_vertical: 1.31 + cmp #35 ; Compare the right edge to the character's 1.32 + bcc check_monster_common_exit ; left edge and exit if too far left. 1.33 + cmp #42 ; Compare the left edge to the character's 1.34 + bcs check_monster_common_exit ; right edge and exit if too far right. 1.35 1.36 lda player_y ; Check for the top of the character. 1.37 asl
