Lately I've been working with my main character sprite and its movements.
I've done simple things like make my character duck and move side to
side witout any problems. For the duck I just replaced my tiles with the
tiles combined to make the character look like he is ducking. I've run
into a little bit of a snag with moving left and right as far as changing the
different sprite tiles go. All my movements are happening inside NMI.
I have 3 different sets of sprite tiles for the characters legs ( to give the
illusion that the character is walking). When I press left (even once) it goes
through all 3 sets extremely quick.
This is what I have. If you don't mind .. could you tell me if this is the right
way or if there is a better way to go about this. Thanks.
I've done simple things like make my character duck and move side to
side witout any problems. For the duck I just replaced my tiles with the
tiles combined to make the character look like he is ducking. I've run
into a little bit of a snag with moving left and right as far as changing the
different sprite tiles go. All my movements are happening inside NMI.
I have 3 different sets of sprite tiles for the characters legs ( to give the
illusion that the character is walking). When I press left (even once) it goes
through all 3 sets extremely quick.
This is what I have. If you don't mind .. could you tell me if this is the right
way or if there is a better way to go about this. Thanks.
Code:
.zp
....
isWalking = $03
....
nmi:
....
jsr controlStrobe ; read controller
....
controlStrobe:
........
LPress:
lda $4016 ; Left
and #1
beq RPress
lda <isWalking
cmp #0
beq walk_1
cmp #1
beq walk_2
cmp #2
beq walk_3
walk_1:
lda #$52
sta IMG4.T
lda #$11
sta IMG5.T
lda #6
sta IMG6.T
lda #7
sta IMG7.T
lda #$01
sta <isWalking
lda #$00
beq scr_left
walk_2:
sta IMG4.T
lda #$58
sta IMG5.T
lda #$59
sta IMG6.T
lda #$5A
sta IMG7.T
lda #$02
sta <isWalking
lda #$00
beq scr_left
walk_3:
lda #$5B
sta IMG4.T
lda #$5C
sta IMG5.T
lda #$5D
sta IMG6.T
lda #$5E
sta IMG7.T
lda #$00
sta <isWalking
beq scr_left
.....
....
isWalking = $03
....
nmi:
....
jsr controlStrobe ; read controller
....
controlStrobe:
........
LPress:
lda $4016 ; Left
and #1
beq RPress
lda <isWalking
cmp #0
beq walk_1
cmp #1
beq walk_2
cmp #2
beq walk_3
walk_1:
lda #$52
sta IMG4.T
lda #$11
sta IMG5.T
lda #6
sta IMG6.T
lda #7
sta IMG7.T
lda #$01
sta <isWalking
lda #$00
beq scr_left
walk_2:
sta IMG4.T
lda #$58
sta IMG5.T
lda #$59
sta IMG6.T
lda #$5A
sta IMG7.T
lda #$02
sta <isWalking
lda #$00
beq scr_left
walk_3:
lda #$5B
sta IMG4.T
lda #$5C
sta IMG5.T
lda #$5D
sta IMG6.T
lda #$5E
sta IMG7.T
lda #$00
sta <isWalking
beq scr_left
.....