I am trying to get an effect with sprites moving in a sine wave pattern similar to what happens in wamma's quantumdisco brothers demo at about 1:10
https://www.youtube.com/watch?v=hhoa_K75BKI
It is vaguely NSFW as there is low res naked person in the background.
I ASSUME that the sprites are all grouped as a large meta sprite which controls the movement of the whole spiral of sprites back and forth across the screen. I also guess the individual sprites are following the "control" sprite with a movement offset of some sort.
I have a little proof of concept rom where I have 4 sprites defined as a meta sprite moving right and left which is good. They are also mapped with an offset which is also great. The problem is they are moving as one static sprite rather than individually and I am not sure why.
Would anyone be able to point me in the right direction? I think this code is probably the problem. Sorry it is a bit long.
https://www.youtube.com/watch?v=hhoa_K75BKI
It is vaguely NSFW as there is low res naked person in the background.
I ASSUME that the sprites are all grouped as a large meta sprite which controls the movement of the whole spiral of sprites back and forth across the screen. I also guess the individual sprites are following the "control" sprite with a movement offset of some sort.
I have a little proof of concept rom where I have 4 sprites defined as a meta sprite moving right and left which is good. They are also mapped with an offset which is also great. The problem is they are moving as one static sprite rather than individually and I am not sure why.
Would anyone be able to point me in the right direction? I think this code is probably the problem. Sorry it is a bit long.
Code:
;-----movesprites---------------------------------------------
movemetasprite:
movemetaspriteright:
LDA metaspriteright
BEQ movemetasprightrightdone ;if metaspriteright=0, skip this section
LDA sprite_RAM+3
CLC
ADC metaspritespeedx ;sprite_RAM position = sprite_RAM + metaspritespeedx
STA sprite_RAM+3
LDA sprite_RAM+3
CMP #rightside
BCC movemetasprightrightdone ;if sprite_RAM < rightside, still on screen, skip next section
LDA #$00
STA metaspriteright
LDA #$01
STA metaspriteleft ;bounce, metasprite now moving left
movemetasprightrightdone:
movemetaspriteleft:
LDA metaspriteleft
BEQ movemetaspriteleftdone ;;if metaspriteleft=0, skip this section
LDA sprite_RAM+3
SEC
SBC metaspritespeedx
STA sprite_RAM+3
LDA sprite_RAM+3
CMP #leftside
BCS movemetaspriteleftdone
LDA #$01
STA metaspriteright
LDA #$00
STA metaspriteleft ;;bounce, now moving right
movemetaspriteleftdone:
RTS
;-----updatesprites-------------------------------
updatesprites:
LDA sprite_RAM ;vertical updates
CLC
ADC #$8
STA sprite_RAM+4
CLC
ADC #$8
STA sprite_RAM+8
CLC
ADC #$8
STA sprite_RAM+12
LDA sprite_RAM+3 ;horizontal updates
STA sprite_RAM+7
STA sprite_RAM+11
STA sprite_RAM+15
rts
;------------------------------------
;-----offset--------------------------------------
offsetmetasprite:
LDA sprite_RAM+3 ;horizontal updates
CLC
ADC #$00
STA sprite_RAM+3
LDA sprite_RAM+7 ;horizontal updates
CLC
ADC #$01
STA sprite_RAM+7
LDA sprite_RAM+11 ;horizontal updates
CLC
ADC #$02
STA sprite_RAM+11
LDA sprite_RAM+15 ;horizontal updates
CLC
ADC #$03
STA sprite_RAM+15
RTS
movemetasprite:
movemetaspriteright:
LDA metaspriteright
BEQ movemetasprightrightdone ;if metaspriteright=0, skip this section
LDA sprite_RAM+3
CLC
ADC metaspritespeedx ;sprite_RAM position = sprite_RAM + metaspritespeedx
STA sprite_RAM+3
LDA sprite_RAM+3
CMP #rightside
BCC movemetasprightrightdone ;if sprite_RAM < rightside, still on screen, skip next section
LDA #$00
STA metaspriteright
LDA #$01
STA metaspriteleft ;bounce, metasprite now moving left
movemetasprightrightdone:
movemetaspriteleft:
LDA metaspriteleft
BEQ movemetaspriteleftdone ;;if metaspriteleft=0, skip this section
LDA sprite_RAM+3
SEC
SBC metaspritespeedx
STA sprite_RAM+3
LDA sprite_RAM+3
CMP #leftside
BCS movemetaspriteleftdone
LDA #$01
STA metaspriteright
LDA #$00
STA metaspriteleft ;;bounce, now moving right
movemetaspriteleftdone:
RTS
;-----updatesprites-------------------------------
updatesprites:
LDA sprite_RAM ;vertical updates
CLC
ADC #$8
STA sprite_RAM+4
CLC
ADC #$8
STA sprite_RAM+8
CLC
ADC #$8
STA sprite_RAM+12
LDA sprite_RAM+3 ;horizontal updates
STA sprite_RAM+7
STA sprite_RAM+11
STA sprite_RAM+15
rts
;------------------------------------
;-----offset--------------------------------------
offsetmetasprite:
LDA sprite_RAM+3 ;horizontal updates
CLC
ADC #$00
STA sprite_RAM+3
LDA sprite_RAM+7 ;horizontal updates
CLC
ADC #$01
STA sprite_RAM+7
LDA sprite_RAM+11 ;horizontal updates
CLC
ADC #$02
STA sprite_RAM+11
LDA sprite_RAM+15 ;horizontal updates
CLC
ADC #$03
STA sprite_RAM+15
RTS