Buenas,
Vengo con unas preguntas mas.
Estoy a punto de implementar las balas enemigas.
El caso es que estoy pensando en añadir una colisión de sprites en medio de la pantalla para así poder reescribir la tabla de atributos de sprites y poder tener los 62 pixeles en pantalla en lugar de los 32 habituales.
Como el juego es de scroll vertical, no me queda mas remedio que crear un par de buffers para rellenarlos con atributos todos los frames con todos los sprites que necesite pintar. Cuando un elemento vaya a estar en la parte alta de la pantalla, lo incluiré en el buffer 1, y en el otro caso lo haré en el buffer 2.
Al final del ciclo volcaré los atributos del primer buffer en la VRAM, chequeo de la colisión, y volcado del segundo buffer.
Es esta aproximación correcta?
Por otra parte, he estado buscando tutoriales para detectar las colisiones de sprites, pero solo he encontrado código en BASIC o cosas que me cuesta mucho entenderlas. Alguien podría tener la amabilidad de explicarlo de tal modo que hasta un niño de 5 años entendería?
Por cierto, esta técnica no se vería arruinada si se producen otras colisiones de sprites anteriores a la que vamos a forzar en la mitad de la pantalla?
Gracias de antemano.
PD: Me compre el SDD+, y es una gozada verlo en el MSX autentico!
If I correctly understand, you are on the right way for screen split but there is a detail to make clear (sorry maybe it is only a problem of my comprehension of Spanish)
You need in VRAM two SATS, one for the upper half of the screen another for the lower part.
You can swap the two SATS by writing vdp register #5
E.g.
set Vdp R#5 = 0x36 ; SAT at 0x1b00 for upper sprites
set Vdp R#5 = 0x37 ; SAT at 0x1b80 for lower sprites
To swap at a given raster line I suggest you poll not for collisions but for 5th sprite condition.
Just sacrifice the last 5 sprites from the upper SAT and set them transparent at Y = 128 (out of the active area of your game, eg. X = 255)
This means that the VDP will report in the status register 5th sprite condition for plane #31 (the last one)
At ISR the raster beam is at the very beginning of the lower border, so you can do something like this:
ISR:
set Vdp R#5 = 0x36
do other stuff (eg. VRAM update for PNT and sprites, music ecc..): NB make sure this code always ends BEFORE the raster line is at Y = 128, or you will miss the split line
poll the status register and test for bit 6 (meaning 5th sprite condition) and for plane 31 (in the lower 5 bits)
1: in a,(0x99)
and 0x5f
cp 0x5F ; plane 31 =0x1F
jp nz,1b
You need this to avoid other 5th sprite conditions that can happen in the upper part of the screen. If they happen, they will involve lower sprite planes, so you can skip them, as this polling loop will wait exactly for plane 31 being the 5th sprite on a line.
set Vdp R#5 = 0x37 (SAT at 0x1b80 for lower sprites)
do other things (if needed )
ret
I hope this helps
About how to fill the two sats, you are on the right way: objects that need to appear in the upper half of the screen have to stay only in the first sat, objects that need to appear in the lower part of the screen have to stay only in the second sat
BUT
when an object moves across Y = 128 you have to put it in both SATs or it will partially disappear during the transition