I cannot for the life of me figure out sprites. I can write the code to load the initial sprites, that's easy. What I can't figure out is how to get more to load during game play (Push a button and sprite appears) or make them go away during game play (Push a button and the sprite is gone). Essentially, my sprites don't move, they are just replaced by other sprites. So, here is an example below (not my actual code, but I want to make my code do this):
Here is what I want my code to do:
-Initially Load sprite1 and sprite4 (I can do this)
-Press and hold Button A - sprite1 changes to sprite2 (and sprite2 changes to another and this continues until you get to the last sprite or release A, to keep it simple, I am just stopping at sprite2) AND
sprite3 changes to sprite4
-Release Button A - first set of sprites (sprite1 and sprite2) stop changing AND sprite4 changes back to sprite3
-Press Button B - sprite2 changes back to sprite1
So, basically, I want to push a button and make a sprite leave the screen and make a different sprite load on the screen in the exact same location. Sprites 1 and 2 are beer mugs and sprites 3 and 4 are the tap handle. Press Button A, fill mug (series of 7 sprites) and tap the handle. Let go of A, mug stops filling and handle go back to the up position. Press B, a new empty mug loads.
Example Code:
;;Initial Sprite Load
LoadSprite1:
LDX #$00 ; start at 0
.Loop:
LDA sprites1, x ; load data from address (sprites + x)
STA $0200, x ; store into RAM address ($0200 + x)
INX ; X = X + 1
CPX #$10 ; Compare X to hex $10
BNE .Loop ; Branch to LoadSpritesLoop if compare was Not Equal to zero
LoadSprite3:
LDX #$00 ; start at 0
.Loop:
LDA sprites2, x ; load data from address (sprites + x)
STA $0220, x ; store into RAM address ($0220 + x)
INX ; X = X + 1
CPX #$08 ; Compare X to hex $08
BNE .Loop ; Branch to LoadSpritesLoop if compare was Not Equal to zero
sprite1: ;empty mug
;vert tile attr horiz
.db $80, $00, $00, $90 ;tile 0
.db $80, $01, $00, $98 ;tile 1
.db $88, $02, $00, $90 ;tile 2
.db $88, $03, $00, $98 ;tile 3
sprite2: ;start to fill mug
;vert tile attr horiz
.db $80, $04, $00, $90 ;tile 4
.db $80, $05, $00, $98 ;tile 5
.db $88, $06, $00, $90 ;tile 6
.db $88, $07, $00, $98 ;tile 7
sprite3: ;handle not tapped
;vert tile attr horiz
.db $60, $08, $00, $90 ;tile 8
.db $68, $09, $00, $90 ;tile 9
sprite4: ;tapped handle
;vert tile attr horiz
.db $60, $0A, $00, $90 ;tile 10
.db $68, $0B, $00, $90 ;tile 11
.db $60, $0C, $00, $88 ;tile 12
.db $68, $0D, $00, $88 ;tile 13
***NOTE*** The code I listed is just an example, so it proably has errors in the logic. I can fix that. I am just confused on process.
Sorry if my question isn't clear, I'm just so confused, I really don't even know how to ask what I'm trying to do.