Animation

This commit is contained in:
RochesterX
2026-02-17 11:19:51 -05:00
parent 94b5d57049
commit fbfc6401ec
3 changed files with 97 additions and 10 deletions

BIN
plat.nes

Binary file not shown.

97
plat.s
View File

@@ -352,12 +352,14 @@ example_palette:
.byte $0F,$09,$1A,$16 ; grass .byte $0F,$09,$1A,$16 ; grass
.byte $0F,$15,$26,$37 ; bg0 purple/pink .byte $0F,$15,$26,$37 ; bg0 purple/pink
.byte $0F,$09,$19,$29 ; bg1 green .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,$01,$11,$21 ; bg2 blue
.byte $0F,$00,$10,$30 ; bg3 greyscale .byte $0F,$00,$10,$30 ; bg3 greyscale
.byte $0F,$18,$28,$38 ; sp0 yellow ; .byte $0F,$18,$28,$38 ; sp0 yellow
.byte $0F,$14,$24,$34 ; sp1 purple ; .byte $0F,$14,$24,$34 ; sp1 purple
.byte $0F,$1B,$2B,$3B ; sp2 teal ; .byte $0F,$1B,$2B,$3B ; sp2 teal
.byte $0F,$12,$22,$32 ; sp3 marine ; .byte $0F,$12,$22,$32 ; sp3 marine
.segment "ZEROPAGE" .segment "ZEROPAGE"
buttons: .res 1 buttons: .res 1
@@ -367,6 +369,9 @@ player_pos_y: .res 1
player_vel_x: .res 1 player_vel_x: .res 1
player_vel_y: .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_x: .res 1
cursor_y: .res 1 cursor_y: .res 1
temp_x: .res 1 temp_x: .res 1
@@ -421,15 +426,73 @@ main:
draw_player: draw_player:
lda player_pos_y lda player_pos_y
sec 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 * 0) + 0
sta oam + (4 * 1) + 0 sta oam + (4 * 1) + 0
lda player_status
and #%00000001
cmp #0
bne :+
lda player_pos_x lda player_pos_x
sta oam + (4 * 1) + 3 sta oam + (4 * 1) + 3
sta oam + (4 * 3) + 3
sec sec
sbc #8 sbc #8
sta oam + (4 * 0) + 3 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 rts
@@ -461,6 +524,7 @@ init_objects:
lda #0 lda #0
sta player_vel_x sta player_vel_x
sta player_vel_y sta player_vel_y
sta player_status
rts rts
@@ -469,6 +533,21 @@ draw:
rts rts
movement: 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 ; Horizontal velocity
ldx #0 ldx #0
jsr btn_right jsr btn_right
@@ -477,6 +556,10 @@ movement:
ldx #1 ldx #1
lda #3 lda #3
sta player_vel_x sta player_vel_x
lda player_status
and #%11111110
sta player_status
: :
jsr btn_left jsr btn_left
@@ -485,6 +568,10 @@ movement:
ldx #1 ldx #1
lda #253 lda #253
sta player_vel_x sta player_vel_x
lda player_status
ora #%00000001
sta player_status
: :
cpx #1 cpx #1

Binary file not shown.