foreground/background question

Basic and Machine Language

Moderator: Moderators

Post Reply
adric22
Vic 20 Hobbyist
Posts: 143
Joined: Fri Mar 11, 2005 6:54 pm

foreground/background question

Post by adric22 »

Okay, well I've made some progress in the 8 hours or so I've been coding. Before I ask my question, here's a screenshot:
Image
Right now I'm just working on the game engine, so there isn't much else on the screen at the moment. But you can see my "tank" in the center surrounded by some trees, grass, and water. I can drive around and create different obects on a 128x128 map at the moment. Yes, I plan to redefine the character set eventually, but I am just making use of existing characters for the moment. Now, onto my question...

As I mentioned in my last post, I'm rather new to VIC-20 programming. See that "water" in my image.. Essentially just a reversed blue equals sign. Well, what I want to do is have a blue background for the character and then have white foreground for the character. That way when I create my new character set, I should have white waves on top of blue water. For the moment I'd settle for a white equals sign with a blue background. How do I accomplish this?
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: foreground/background question

Post by Mike »

adric22 wrote:For the moment I'd settle for a white equals sign with a blue background. How do I accomplish this?
First (simple) answer: You can't. Hires character cells share the background colour (unless you resort to raster tricks - and that has been discussed in another thread just 2 days ago - where you are hard-pressed to get even *near* to character resolution).
Yes, I plan to redefine the character set eventually, but I am just making use of existing characters for the moment.
Second answer: Use UDG's and multicolour enable.

Greetings,

Michael
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

However realize multicolour reduces the horizontal resolution to four pixels per character. You may have seen this mode on the C64, but since VIC-20 pixels already from the beginning are wider, you get really wide pixels in multicolour mode. Since the vertical resolution still is eight pixels per character, it may still work for a wave effect.

In multicolour mode your two extra colours are picked up from the border colour (0-7) and upper nybble of the volume register 36878 (0-15). Like Mike mentions, all these remain the same for the whole screen unless you go into raster tricks. If you want blue water with white waves, you may set the border colour to white and use this as your first multicolour. It means you still have a second colour available for any other graphics you want more colours into, and can even use colours 8-15. Of course if you will have no other use of multicoloured graphics you can set the volume register to $1x and have an independent border colour not reflected in the graphics.
Anders Carlsson

Image Image Image Image Image
Post Reply