• entries
    104
  • comments
    101
  • views
    255339

A C64 Game - Step 49

Sign in to follow this  
Endurion

1814 views

Bug fixing time. Don't ever let the bug count get out of hand.

Most enemies wouldn't have a proper hit back effect. Also, some sprites are moving inside the floor visually. We'll fix that in this step.

step49.png

Hit back works the same for all enemies, so let's make it a new sub routine. The routine is to be called at the start of an enemies custom behaviour code:

;------------------------------------------------------------
;handles simple hitback
;------------------------------------------------------------
!zone HandleHitBack
HandleHitBack
          lda SPRITE_HITBACK,x
          beq .NoHitBack
          dec SPRITE_HITBACK,x
          lda SPRITE_HITBACK_DIRECTION,x
          beq .HitBackRight

          ;move left
          jsr ObjectMoveLeftBlocking
          lda #1
          rts

.HitBackRight
          jsr ObjectMoveRightBlocking
          lda #1
          rts

.NoHitBack
          lda #0
          rts


For every behaviour routine we add this in:

          jsr HandleHitBack
          beq .NoHitBack
          rts

.NoHitBack 


Fortunately, to fix the sprite offset problem we already have the solution in form of a start offset table. We just amend some values (note all the new entries with value 2):

TYPE_START_DELTA_Y
          !byte 0 ;dummy
          !byte 0 ;player dean
          !byte 0 ;bat 1
          !byte 0 ;bat 1
          !byte 0 ;bat 2
          !byte 0 ;mummy
          !byte 0 ;zombie
          !byte 0 ;nasty bat
          !byte 0 ;spider
          !byte 0 ;explosion
          !byte 0 ;player sam
          !byte 2 ;wolf
          !byte 0 ;ghost skeleton
          !byte 2 ;jumping toad
          !byte 0 ;eye
          !byte 0 ;floating ghost
          !byte 0 ;fly
          !byte 2 ;slime
          !byte 2 ;frankenstein
          !byte 2 ;hand
          !byte 2 ;devil
          !byte 0 ;impala 1
          !byte 0 ;impala 2
          !byte 0 ;impala 3
          !byte 0 ;impala driver
          !byte 0 ;impala debris


step49.zip

Previous Step Next Step

Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now