Jump to content
Yoruk

bB - changing background color on the fly

Recommended Posts

Hello there,

 

Is there a way to update/change COLUBK at mid-screen ?

 

I'm looking for a way to split my screen in two colors (horizontally !!), without using the playfield. Something like this :

 

 

image.png.7eaa477355e84cfb6053115c0494d945.png

 

Maybe by using a small assembly routine inside my game loop ?

 

Thanks !

 

 

Share this post


Link to post
Share on other sites

Adding the code to the game loop will not have an effect.  Mid-screen changes like that need to be part of the kernel code, and bB code runs during overscan. What you want is the background kernel option to allow you to do this.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks for the tip, but I didn't manage to make it work.

 

So if I understand correctly, by setting up the background kernel option it allows me to use the playfield color table to paint the background instead of the playfield blocks.

 

So I added :

 set kernel multisprite

 set kernel_options pfcolors no_blank_lines background

and

 

 pfcolors:
   $0E
   $0E
   $0E
   $0E
   $0E
   $B6
   $B6
   $B6
   $F4
   $F4
   $C4
   $0E
end

 

before my main loop. But there is an error during the assembly :

 

--- Unresolved Symbol List
pfcolortable             0000 ????         (R )

      2561 bytes of ROM space left

So maybe I'm not filling the data in the good array...?

 

Share this post


Link to post
Share on other sites

I mistakenly assumed you were using the standard kernel. Both the standard kernel and DPC+ have a way of changing the background color mid-screen, but the multisprite kernel does not. Also, you would use "bkcolors" instead of "pfcolors" to define them. 

Share this post


Link to post
Share on other sites

Aouch sorry for being not accurate enough in my description.

 

My main constraint is to have the multi-sprite kernel. I'll have only one sprite on a scanline at a time, so it should work.

 

So in this case my only chance to have my two colors background is with a standard playfield ? They say that the PF is mirrored (no so problems here), and that I must use the "playfield" command to draw my background. But I don't know if there is color limitations ?

 

I'm not yet familiar with the pfheight variable, I'll try that...

 

Thanks !

 

Share this post


Link to post
Share on other sites

The Multisprite kernel is a special case, and it has its own limitations. It doesn't have any kernel options like the standard kernel does. If you wanted to set COLUBK to one color, and COLUPF to another color, then that would be one way to have two different colors on the screen like you were wanting, but I don't know if you were planning on using the playfield for anything else.

Share this post


Link to post
Share on other sites

Many thanks ! It should work perfectly. 😃

 

No, I'll not use the PF for anything else than pure drawing (no collisions checks....).

Share this post


Link to post
Share on other sites

There is a modified multi sprite kernel that supports a multi colored background used in this flappy bird demo:

 

It has its quirks.  One of which is that your player sprites can cause the background color to spill over to other rows depending on the y position.  So, you have to program around that and it usually involves very chunky vertical movement (to skip lines that would cause the background color to bleed).  Also, one background theme per game.  You could *probably* get around that by making a multi kernel game using RevEngs multi kernel framework.

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...