JorgeLiborinho, on Wed Feb 9, 2011 6:50 PM, said:
What codes I use to leave the playfield solid player does not pass?
I haven't tried out your code, but if I understand your question correctly, you want the players to pass behind the playfield rather than in front of it?
To do that you need to turn on bit 2 of the CTRLPF register (i.e., set it to 1).
Note that the CTRLPF register also controls whether the playfield is repeated or reflected, whether the "playfield score mode" is on or off, and the size (i.e., width) of the ball sprite, as follows:
CTRLPF bit 0 = playfield draw mode
off (0) = draw a repeated playfield
on (1) = draw a reflected playfield
CTRLPF bit 1 = playfield score mode
off (0) = draw the playfield using the color in the COLUPF register
on (1) = draw the left half of the playfield using the color in the COLUP0 register, and draw the right half of the playfield using the color in the COLUP1 register
CTRLPF bit 2 = playfield priority
off (0) = draw the players in front of the playfield
on (1) = draw the playfield in front of the players
CTRLPF bits 4 and 5 = ball width
= draw the ball 1 color clock wide
%01 = draw the ball 2 color clocks wide
%10 = draw the ball 4 color clocks wide
%11 = draw the ball 8 color clocks wide
Since batari Basic draws an asymmetrical playfield using a reflected playfield, you should be careful when setting the CTRLPF register to a given value, because you might end up messing up the playfield's appearance by inadvertently setting it to the repeated mode. When you want to change the value of a register that has multiple functions (as the CTRLPF register does), you can either add up the values of all the bits you want to turn on and then set the register to the total, or you can turn the bits on or off individually.
That is, each bit of a byte corresponds to a particular decimal value, as follows:
bit 0 -- off = +0, on = +1
bit 1 -- off = +0, on = +2
bit 2 -- off = +0, on = +4
bit 3 -- off = +0, on = +8
bit 4 -- off = +0, on = +16
bit 5 -- off = +0, on = +32
bit 6 -- off = +0, on = +64
bit 7 -- off = +0, on = +128
If you want a particular bit to be off, don't add its value into the total (i.e., add 0 for that bit). But if you want the bit to be on, then add its value into the total. For example, suppose you want to get the following results:
- Draw a reflected playfield.
- Draw the playfield with the COLUPF color.
- Draw the players behind the playfield (or draw the playfield in front of the players).
- Draw the ball 4 color clocks wide.
To do that you would want bit 0 to be on (+1), bit 1 to be off (+0), bit 2 to be on (+4), bit 4 to be off (+0), and bit 5 to be off (+32), so the total is 1+0+4+0+32 = 37. Thus, you could add the following line of code to your program somewhere before the "drawscreen" command:
CTRLPF = 37
The other way to do it would be to turn the desired bits on or off individually. For example, if all you really want to do is make the players move behind the playfield, without messing up any of batari Basic's default settings, you could just turn on bit 2 of the CTRLPF register by adding the following line of code to your program somewhere before the "drawscreen" command:
CTRLPF{2} = 1
Michael