diff --git a/plat.nes b/plat.nes index b339706..856d640 100644 Binary files a/plat.nes and b/plat.nes differ diff --git a/plat.s b/plat.s index 733b44a..dbe3be4 100644 --- a/plat.s +++ b/plat.s @@ -352,12 +352,14 @@ example_palette: .byte $0F,$09,$1A,$16 ; grass .byte $0F,$15,$26,$37 ; bg0 purple/pink .byte $0F,$09,$19,$29 ; bg1 green +.byte $0F,$2D,$10,$3D ; reboot bottom +.byte $0F,$2D,$10,$2C ; reboot eye .byte $0F,$01,$11,$21 ; bg2 blue .byte $0F,$00,$10,$30 ; bg3 greyscale -.byte $0F,$18,$28,$38 ; sp0 yellow -.byte $0F,$14,$24,$34 ; sp1 purple -.byte $0F,$1B,$2B,$3B ; sp2 teal -.byte $0F,$12,$22,$32 ; sp3 marine +; .byte $0F,$18,$28,$38 ; sp0 yellow +; .byte $0F,$14,$24,$34 ; sp1 purple +; .byte $0F,$1B,$2B,$3B ; sp2 teal +; .byte $0F,$12,$22,$32 ; sp3 marine .segment "ZEROPAGE" buttons: .res 1 @@ -367,6 +369,9 @@ player_pos_y: .res 1 player_vel_x: .res 1 player_vel_y: .res 1 +player_status: .res 1 ; 76543210 | 0: facing (0 right, 1 left) + ; | 7: talking + cursor_x: .res 1 cursor_y: .res 1 temp_x: .res 1 @@ -421,15 +426,73 @@ main: draw_player: lda player_pos_y sec - sbc #9 + sbc #1 + sta oam + (4 * 2) + 0 + sta oam + (4 * 3) + 0 + sec + sbc #16 sta oam + (4 * 0) + 0 sta oam + (4 * 1) + 0 - lda player_pos_x - sta oam + (4 * 1) + 3 - sec - sbc #8 - sta oam + (4 * 0) + 3 + lda player_status + and #%00000001 + cmp #0 + bne :+ + lda player_pos_x + sta oam + (4 * 1) + 3 + sta oam + (4 * 3) + 3 + sec + sbc #8 + sta oam + (4 * 0) + 3 + sta oam + (4 * 2) + 3 + jmp :++ + : + lda player_pos_x + sta oam + (4 * 0) + 3 + sta oam + (4 * 2) + 3 + sec + sbc #8 + sta oam + (4 * 1) + 3 + sta oam + (4 * 3) + 3 + : + + lda player_status + and #%10000000 + cmp #0 + bne :+ + lda #$45 + jmp :++ + : + lda #$49 + : + sta oam + (4 * 0) + 1 + clc + adc #2 + sta oam + (4 * 1) + 1 + lda #$65 + sta oam + (4 * 2) + 1 + lda #$67 + sta oam + (4 * 3) + 1 + + + lda player_status + and #%00000001 + cmp #0 + beq :+ + lda #%01000000 + jmp :++ + : + lda #%00000000 + : + + ora #%00000001 + sta oam + (4 * 0) + 2 + ora #%00000001 + sta oam + (4 * 1) + 2 + and #%11111100 + sta oam + (4 * 2) + 2 + and #%11111100 + sta oam + (4 * 3) + 2 rts @@ -461,6 +524,7 @@ init_objects: lda #0 sta player_vel_x sta player_vel_y + sta player_status rts @@ -469,6 +533,21 @@ draw: rts movement: + ; Talking + ldx #0 + jsr btn_b + cmp #0 + beq :+ + lda player_status + ora #%10000000 + sta player_status + jmp :++ + : + lda player_status + and #%01111111 + sta player_status + : + ; Horizontal velocity ldx #0 jsr btn_right @@ -477,6 +556,10 @@ movement: ldx #1 lda #3 sta player_vel_x + + lda player_status + and #%11111110 + sta player_status : jsr btn_left @@ -485,6 +568,10 @@ movement: ldx #1 lda #253 sta player_vel_x + + lda player_status + ora #%00000001 + sta player_status : cpx #1 diff --git a/sprite.chr b/sprite.chr index 5514dc1..9444786 100644 Binary files a/sprite.chr and b/sprite.chr differ