fish: more work on fish motion

This commit is contained in:
Vince Weaver 2024-06-12 12:45:58 -04:00
parent 5167815cdb
commit 111a233a5b
3 changed files with 110 additions and 35 deletions

View File

@ -216,12 +216,16 @@ load_background:
sta HGR_PAGE
jsr hgr_make_tables
; testing
lda #$12
; init score
lda #$00
sta SCORE_L
lda #$78
sta SCORE_H
; init fish
lda #$FF
sta RED_FISH_STATE
sta GREY_FISH_STATE
sta GREEN_FISH_STATE
; start at least 8k in?
@ -352,7 +356,73 @@ draw_common_animation:
jsr hgr_draw_sprite_big
;============================
; draw fish
; handle fish
;============================
; TODO: if fish not out, randomly start one?
handle_fish:
handle_red_fish:
lda RED_FISH_STATE
bpl done_handle_fish ; positive means fish is active
; create new red fish
lda #0
sta RED_FISH_STATE
done_handle_fish:
; draw red fish
draw_red_fish:
ldx RED_FISH_STATE
bmi draw_grey_fish ; negative means no fish
lda #<big_fish_sprite
sta INL
lda #>big_fish_sprite
sta INH
lda #<red_fish_mask
sta MASKL
lda #>red_fish_mask
sta MASKH
lda red_fish_x,X
sta SPRITE_X
lda red_fish_y,X
bne red_fish_still_good
; red fish done
lda #$ff ; disable fish
sta RED_FISH_STATE
bmi done_draw_red_fish ; bra
red_fish_still_good:
sta SPRITE_Y
jsr hgr_draw_sprite_mask
inc RED_FISH_STATE
done_draw_red_fish:
; red fish
; 120,183? (bottom)
; u 14? to maybe 160? pause 5?
; r 8? blow bubble? pause 8?
; r quickly through reeds, off screen
;
draw_grey_fish:
draw_green_fish:
.if 0
lda #<left_fish_sprite
sta INL
@ -372,7 +442,7 @@ draw_common_animation:
sta SPRITE_Y
jsr hgr_draw_sprite_mask
.endif
;============================
@ -605,11 +675,6 @@ lure_sprites_h:
.byte >sb_sprite,>sb_fish1_sprite
.byte >sb_sprite
numbers_h:
.byte >zero_sprite,>one_sprite,>two_sprite
.byte >three_sprite,>four_sprite,>five_sprite
.byte >six_sprite,>seven_sprite,>eight_sprite
.byte >nine_sprite
numbers_l:
.byte <zero_sprite,<one_sprite,<two_sprite
@ -617,6 +682,11 @@ numbers_l:
.byte <six_sprite,<seven_sprite,<eight_sprite
.byte <nine_sprite
numbers_h:
.byte >zero_sprite,>one_sprite,>two_sprite
.byte >three_sprite,>four_sprite,>five_sprite
.byte >six_sprite,>seven_sprite,>eight_sprite
.byte >nine_sprite
bg_data:
.incbin "graphics/fish_bg.hgr.zx02"
@ -652,6 +722,13 @@ bg_data:
; r quickly through reeds, off screen
;
red_fish_x:
.byte 17
.byte 17,17,17,17,17,17,17,17,17,17,17,17,17,17
red_fish_y:
.byte 184
.byte 182,180,178,176,174,172,170,168,166,164,162,160,158,156,0
; left fish, (grey) appears in reeds
; 218,170 or so
; left 8 to center of boat gradually up, blows bubble

View File

@ -63,7 +63,7 @@ fish_sprites.inc: fish_sprites.png
$(HGR_SPRITE) -s -l left_fish_sprite fish_sprites.png 0 29 20 36 >> fish_sprites.inc
$(HGR_SPRITE) -s -l right_fish_sprite fish_sprites.png 0 38 20 45 >> fish_sprites.inc
$(HGR_SPRITE) -s -l big_fish_sprite fish_sprites.png 0 47 27 54 >> fish_sprites.inc
$(HGR_SPRITE) -s -l zero_sprite fish_sprites.png 0 0 6 79 >> fish_sprites.inc
$(HGR_SPRITE) -s -l zero_sprite fish_sprites.png 0 72 6 79 >> fish_sprites.inc
$(HGR_SPRITE) -s -l one_sprite fish_sprites.png 14 72 20 79 >> fish_sprites.inc
$(HGR_SPRITE) -s -l two_sprite fish_sprites.png 28 72 34 79 >> fish_sprites.inc
$(HGR_SPRITE) -s -l three_sprite fish_sprites.png 42 72 48 79 >> fish_sprites.inc

View File

@ -140,34 +140,32 @@ CURRENT_DISK = $DC
SCORE_L = $E0
SCORE_H = $E1
;D1_SCORE = $E0
;D1_SCORE_H = $E1
;D2_SCORE = $E2
;D2_SCORE_H = $E3
RED_FISH_STATE = $E2
GREEN_FISH_STATE = $E3
GREY_FISH_STATE = $E4
FISH_STATE_NONE = $FF
FISH_STATE_PAUSE = $00
FISH_STATE_UP = $01
FISH_STATE_BUBBLE = $02
FISH_STATE_RIGHT = $03
FISH_STATE_FAST_RIGHT = $04
FISH_STATE_LEFT_UP = $05
FISH_STATE_LEFT_DOWN = $06
FISH_STATE_FLIP = $07
D1_STATE = $E4
DUCK_MISSING = $00
DUCK_LEFT = $00
DUCK_RIGHT = $80
DUCK_NORMAL = $01
DUCK_MOVE = $02
DUCK_FEEDING = $03
D2_STATE = $E5
RED_FISH_X = $E5
GREEN_FISH_X = $E6
GREY_FISH_X = $E7
D1_XPOS = $E6
D2_XPOS = $E7
RED_FISH_Y = $E8
GREEN_FISH_Y = $E9
GREY_FISH_Y = $EA
D1_YPOS = $E8
D2_YPOS = $E9
RED_FISH_SPRITE = $EB
GREEN_FISH_SPRITE= $EC
GREY_FISH_SPRITE= $ED
D1_XSPEED = $EA
D2_XSPEED = $EB
D1_YSPEED = $EC
D2_YSPEED = $ED
OLD_X = $EC
OLDER_X = $ED
DISP_PAGE = $EE
DRAW_PAGE = $EF