Jump to content

April 2017 »

S M T W T F S
      1
2345678
9101112131415
16171819202122
2324252627 28 29
30      
- - - - -

A C64 Game - Step 49



4: Adsense

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.

Attached Image

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

Previous Step Next Step

Attached Files

Note: GameDev.net moderates comments.