i can do it with a sprite in trasm, this code move the layer 2 as a earie, but its leads to appearance of glitched graphics:
dcb "INIT"
LDA #$00
STA $157C,x ;decide si sube o baja
REP #$20
LDA.w #$0000
STA.w $1923;posicion relativa al layer 1 en X del layer 2 inicia en 0
STA.w $1926;velocidad Y del layer 2 inicia en 0
LDA.w $1462
STA.w $1466;setea la posicion del layer 2 = a la posicion del layer 1
SEP #$20
RTL
;iniciaciones
dcb "MAIN"
PHB ;\
PHK ; | Change the data bank to the one our code is running from.
PLB ; | This is a good practice.
JSR SpriteCode ; | Jump to the sprite's function.
PLB ; | Restore old data bank.
RTL ;/ And return.
;===================================
;Sprite Function
;===================================
RETURN: RTS
SpriteCode:
JSR Graphics
LDA $9D ;\
BNE RETURN ;/ If locked, return.
REP #$20
LDA.w $1923
CLC
ADC.w #$0001
STA.w $1923;le sumo 1 a la posicion relativa en X
LDA.w $1462;pongo en el registro a el valor de la posicion del layer 1
CLC
SBC.w $1923;le sumo la posicion relativa en X
STA.w $1466;le seteo el valor a la posicion absoluta en X
SEP #$20
REP #$20
LDA.w $1926
CMP.w #$0009
BMI seguir1
SEP #$20
LDA #$01
STA $157C,x
REP #$20
seguir1:
REP #$20
LDA.w $1926
CMP.w #$FFF8
BPL seguir2
SEP #$20
STZ $157C,x
seguir2:
SEP #$20
LDA $157C,x
BEQ subir ;si es 0 sube si no baja
LDA $13
AND #$01
BEQ seguir3
JMP movY
seguir3:
REP #$20
LDA.w $1926
CLC
SBC.w #$0001
STA.w $1926
SEP #$20
JMP movY;le resta 1 a la velocidad en Y y salta a movY
subir:
REP #$20
LDA.w $1926
CLC
ADC.w #$0001
STA.w $1926
SEP #$20;le suma 1 a la velocidad en Y
movY:
REP #$20
LDA.w $1468
CLC
ADC.w $1926
STA.w $1468
SEP #$20;le suma la velocidad en Y a la posicion en Y
continuar:
RTS
;aca es un buen lugar para poner las sub rutinas
;===================================
;Graphics Code
;===================================
Graphics:
;inserte rutina grafica aca
RTS
how can i fix them?
Mod edit: Fixed image.
------------------------------------------------------
Youtube
Twitter
SMWControlLibX GitHub
My Discord Server
Follow Us On