junglejourney

changeset 121:c9a57615aab5

Improved fluidity of the gameplay by updating different enemies at different times.
author David Boddie <david@boddie.org.uk>
date Fri Sep 09 21:29:38 2011 +0200
parents 67134c74700e
children 80e5405560ee
files mapcode.oph
diffstat 1 files changed, 17 insertions(+), 13 deletions(-) [+]
line diff
     1.1 --- a/mapcode.oph	Fri Sep 09 00:02:02 2011 +0200
     1.2 +++ b/mapcode.oph	Fri Sep 09 21:29:38 2011 +0200
     1.3 @@ -3426,6 +3426,8 @@
     1.4      clc
     1.5      rts
     1.6  
     1.7 +enemy_slots: .byte 0, 6, 12, 18
     1.8 +
     1.9  move_characters:
    1.10  
    1.11      lda #$8c            ; set the character address
    1.12 @@ -3433,8 +3435,15 @@
    1.13      lda #$51
    1.14      sta $75
    1.15  
    1.16 +    lda $3dfe           ; read a value from 0 to 3 from the motion counter
    1.17 +    and #3
    1.18 +    tax
    1.19 +    lda enemy_slots,x   ; look up the corresponding slot in the character list
    1.20 +    adc $74
    1.21 +    sta $74             ; update the character address
    1.22 +
    1.23      move_characters_loop:
    1.24 -
    1.25 +    
    1.26          ldy #0
    1.27          lda ($74),y
    1.28          cmp #3
    1.29 @@ -3452,16 +3461,17 @@
    1.30          move_characters_next:
    1.31          clc
    1.32  
    1.33 -        ; Examine the next character.
    1.34 -        lda $74
    1.35 +        lda $74                     ; for the last enemy, check the next slot
    1.36 +        cmp #$9e                    ; for the presence of an explosion
    1.37 +        bne move_characters_endloop
    1.38 +        clc
    1.39 +
    1.40          adc #6
    1.41 -
    1.42 -        cmp #$aa
    1.43 -        bpl move_characters_endloop
    1.44          sta $74
    1.45          jmp move_characters_loop
    1.46  
    1.47      move_characters_endloop:
    1.48 +    clc
    1.49  
    1.50      ; Check collisions with the player.
    1.51  
    1.52 @@ -5329,6 +5339,7 @@
    1.53                      jsr reset_unplot_buffer
    1.54                      jsr reset_plot_buffer
    1.55  
    1.56 +                    jsr move_characters
    1.57                      jsr move_projectile
    1.58  
    1.59                      lda $3df0   ; is player out of strength?
    1.60 @@ -5368,13 +5379,6 @@
    1.61                      jsr emerge_characters
    1.62  
    1.63                      no_emerge_characters:
    1.64 -
    1.65 -                    lda $3dfe           ; check motion counter
    1.66 -                    and #3
    1.67 -                    bne no_move_characters
    1.68 -                    jsr move_characters
    1.69 -
    1.70 -                    no_move_characters:
    1.71                      clc
    1.72  
    1.73                      jsr check_fire_key