Jump to content



1

Can we change the color of one row using pfcolors?


8 replies to this topic

#1 Random Terrain ONLINE  

Random Terrain

    Visual batari Basic User

  • 20,910 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Wed Mar 19, 2008 3:07 AM

I see that we can change the color of 11 rows all at once like this:

 pfcolors:
 $f5
 $f5
 $f5
 $43
 $f5
 $f5
 $f5
 $f5
 $f5
 $f5
 $f5
end

But is there a way to change the color of just one row while a game is running without needing to download special files and using Superchip RAM?



Thanks.

Edited by Random Terrain, Wed Mar 19, 2008 3:08 AM.


#2 batari OFFLINE  

batari

    )66]U('=I;B$*

  • 6,236 posts
  • begin 644 contest

Posted Wed Mar 19, 2008 3:34 AM

View PostRandom Terrain, on Wed Mar 19, 2008 4:07 AM, said:

I see that we can change the color of 11 rows all at once like this:

 pfcolors:
 $f5
 $f5
 $f5
 $43
 $f5
 $f5
 $f5
 $f5
 $f5
 $f5
 $f5
end

But is there a way to change the color of just one row while a game is running without needing to download special files and using Superchip RAM?



Thanks.
Define a new list with one color changed. It won't waste any more space to use one more, or even three more, as pfcolor tables are always stored in ROM in groups of four.

#3 Random Terrain ONLINE  

Random Terrain

    Visual batari Basic User

  • 20,910 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Wed Mar 19, 2008 3:38 AM

View Postbatari, on Wed Mar 19, 2008 5:34 AM, said:

Define a new list with one color changed. It won't waste any more space to use one more, or even three more, as pfcolor tables are always stored in ROM in groups of four.
Thanks. I should have been more clear. I wanted the player to be able to change the color of any row.

#4 batari OFFLINE  

batari

    )66]U('=I;B$*

  • 6,236 posts
  • begin 644 contest

Posted Wed Mar 19, 2008 3:45 AM

View PostRandom Terrain, on Wed Mar 19, 2008 4:38 AM, said:

View Postbatari, on Wed Mar 19, 2008 5:34 AM, said:

Define a new list with one color changed. It won't waste any more space to use one more, or even three more, as pfcolor tables are always stored in ROM in groups of four.
Thanks. I should have been more clear. I wanted the player to be able to change the color of any row.
That depends. Do you need to be able to change any/all row colors arbitrarily, or will any single row on the whole screen be changeable to a fixed color? Either can be done without Superchip RAM or additional files, but the former will require 12 of your variables.

#5 Random Terrain ONLINE  

Random Terrain

    Visual batari Basic User

  • 20,910 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Wed Mar 19, 2008 3:55 AM

View Postbatari, on Wed Mar 19, 2008 5:45 AM, said:

That depends. Do you need to be able to change any/all row colors arbitrarily, or will any single row on the whole screen be changeable to a fixed color? Either can be done without Superchip RAM or additional files, but the former will require 12 of your variables.
Yes, any row arbitrarily. The player would move to any row, double-click the fire button and the color of that row would cycle to the next color in the list according to the color chart. Players could have 11 lines of different colors that they could change any time they want.

Would that also work with no_blank_lines?


Thanks.

#6 batari OFFLINE  

batari

    )66]U('=I;B$*

  • 6,236 posts
  • begin 644 contest

Posted Wed Mar 19, 2008 4:11 AM

View PostRandom Terrain, on Wed Mar 19, 2008 4:55 AM, said:

View Postbatari, on Wed Mar 19, 2008 5:45 AM, said:

That depends. Do you need to be able to change any/all row colors arbitrarily, or will any single row on the whole screen be changeable to a fixed color? Either can be done without Superchip RAM or additional files, but the former will require 12 of your variables.
Yes, any row arbitrarily. The player would move to any row, double-click the fire button and the color of that row would cycle to the next color in the list according to the color chart. Players could have 11 lines of different colors that they could change any time they want.

Would that also work with no_blank_lines?


Thanks.
Yes, you can use pfcolors with no_blank_lines.

Setting up the table will take a little time, however, as the variables in 2600basic.h need to be reorganized for it to work (I forgot that the pfcolor tables need values stepping by 4 in ROM, or in this case, RAM.) So I guess I lied, you do need this one file, but it can be done.

#7 Random Terrain ONLINE  

Random Terrain

    Visual batari Basic User

  • 20,910 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Wed Mar 19, 2008 4:45 AM

View Postbatari, on Wed Mar 19, 2008 6:11 AM, said:

Setting up the table will take a little time, however, as the variables in 2600basic.h need to be reorganized for it to work (I forgot that the pfcolor tables need values stepping by 4 in ROM, or in this case, RAM.) So I guess I lied, you do need this one file, but it can be done.
If you get a chance, I'd like to be able to try it even if I have to download a file. If other people want to play with the code, they can always download the special file too.


Thanks.

#8 batari OFFLINE  

batari

    )66]U('=I;B$*

  • 6,236 posts
  • begin 644 contest

Posted Thu Mar 20, 2008 2:46 AM

OK, here is the 2600basic.h file, with some sample code.

You only get variables a-o. Variables p-z do not exist in this file. The row colors 1-11 may be set by row1, row2, row3, up to row11. "Row 0" is the topmost row, and it must be set using COLUPF every frame. Note that these variables are stored in RAM stepping by 4 bytes at a time, so if you instead want to assign mycolor to row "a", where a=1-11, you can do the following:

temp1=(a-1)*4:row1[temp1]=mycolor

The sample program (included) shows one way to set row colors based on a cursor position.

Attached Files


Edited by batari, Thu Mar 20, 2008 2:46 AM.


#9 Random Terrain ONLINE  

Random Terrain

    Visual batari Basic User

  • 20,910 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Thu Mar 20, 2008 8:06 AM

View Postbatari, on Thu Mar 20, 2008 4:46 AM, said:

OK, here is the 2600basic.h file, with some sample code.

You only get variables a-o. Variables p-z do not exist in this file. The row colors 1-11 may be set by row1, row2, row3, up to row11. "Row 0" is the topmost row, and it must be set using COLUPF every frame. Note that these variables are stored in RAM stepping by 4 bytes at a time, so if you instead want to assign mycolor to row "a", where a=1-11, you can do the following:

temp1=(a-1)*4:row1[temp1]=mycolor

The sample program (included) shows one way to set row colors based on a cursor position.
Thanks! I tried it and it works great. Now I'll insert it into the program I'm working on and see what happens.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users