sb: add some head movement

This commit is contained in:
Vince Weaver 2023-06-03 12:48:37 -04:00
parent 6104eb40ba
commit 687e963275
6 changed files with 153 additions and 5 deletions

View File

@ -10,8 +10,17 @@ Duck:
Rat:
+ Exit back to main title
Asplode:
+ Lots
Strongbadzone:
+ Get audio
+ Draw Your Head A Splode
+ Create sprites for ball (24 of them?)
+ Ball movement logic. Is actually just 2D
+ Check bounds on person
+ Sprites for shield positions
+ Sprites with mask?
+ Animate side walls
+ Move head
Cliff:
+ Lots

View File

@ -93,11 +93,47 @@ load_background:
sta STRONGBAD_X
sta PLAYER_X
lda #1
sta STRONGBAD_DIR
;==========================
; main loop
;===========================
main_loop:
inc FRAME
;===========================
; move head
;===========================
lda FRAME
and #$3
bne no_move_head
lda STRONGBAD_X
cmp #22
bcs reverse_head_dir
cmp #12
bcs no_reverse_head_dir
reverse_head_dir:
lda STRONGBAD_DIR
eor #$FF
sta STRONGBAD_DIR
inc STRONGBAD_DIR
no_reverse_head_dir:
clc
lda STRONGBAD_X
adc STRONGBAD_DIR
sta STRONGBAD_X
no_move_head:
;==========================
; draw head
;===========================
@ -128,7 +164,9 @@ main_loop:
check_keypress:
lda KEYPRESS
bpl check_keypress
; bpl check_keypress
bpl done_keyboard_check
bit KEYRESET ; clear the keyboard strobe
; clear high bit
@ -153,7 +191,7 @@ check_keypress:
done_keyboard_check:
jmp check_keypress
jmp main_loop
move_left:
dec PLAYER_X

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -1,6 +1,8 @@
;===========================================
; hgr draw sprite (only at 7-bit boundaries)
;===========================================
; can handle sprites bigger than a 256 byte page
; SPRITE in INL/INH
; Location at SPRITE_X SPRITE_Y
@ -8,8 +10,15 @@
; sprite AT INL/INH
hgr_draw_sprite:
; orange = color5 1 101 0101 1 010 1010
hgr_draw_sprite:
lda SPRITE_X
ror
bcs hgr_draw_sprite_odd
hgr_draw_sprite_even:
ldy #0
lda (INL),Y ; load xsize
clc
@ -89,3 +98,94 @@ sprite_ysize_smc:
rts
hgr_draw_sprite_odd:
ldy #0
lda (INL),Y ; load xsize
clc
adc SPRITE_X
sta osprite_width_end_smc+1 ; self modify for end of line
iny ; load ysize
lda (INL),Y
sta osprite_ysize_smc+1 ; self modify
; point smc to sprite
lda INL ; 16-bit add
sta osprite_smc1+1
lda INH
sta osprite_smc1+2
ldx #0 ; X is pointer offset
stx CURRENT_ROW ; actual row
ldx #2
ohgr_sprite_yloop:
lda CURRENT_ROW ; row
clc
adc SPRITE_Y ; add in cursor_y
; calc GBASL/GBASH
tay ; get output ROW into GBASL/H
lda hposn_low,Y
sta GBASL
lda hposn_high,Y
clc
adc DRAW_PAGE
sta GBASH
ldy SPRITE_X
clc
php ; store 0 carry on stack
osprite_inner_loop:
osprite_smc1:
lda $f000,X ; load sprite data
plp ; restore carry from last
rol ; rotate in carry
asl ; one more time, bit6 in carry
php ; save on stack
sec ; assume blur/orange
ror ; rotate it back down
sta (GBASL),Y ; store to screen
inx ; increment sprite offset
; if > 1 page
bne osprite_no_page_cross
inc osprite_smc1+2
osprite_no_page_cross:
iny ; increment output position
osprite_width_end_smc:
cpy #6 ; see if reached end of row
bne osprite_inner_loop ; if not, loop
plp ; restore stack
inc CURRENT_ROW ; row
lda CURRENT_ROW ; row
osprite_ysize_smc:
cmp #31 ; see if at end
bne ohgr_sprite_yloop ; if not, loop
rts

View File

@ -64,6 +64,7 @@ OLD_MENU_ITEM = $69
NOT_FIRST_TIME = $6A
STRONGBAD_X = $6B
PLAYER_X = $6C
STRONGBAD_DIR = $6D
.if 0
REGISTER_DUMP = $70