Gameboy Development Forum

Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)

You are not logged in.

Ads

#1 2017-06-02 22:00:28

jobalisk
Member
From: I don't even know anymore...
Registered: 2017-05-28
Posts: 55
Website

help with background

I've been doing a bit of digging and I just cant seem to find what I'm looking for.
Pretty much I've set up a map using a tile collection of 8x8 tiles but I just cant work out how to properly use the map as a background.



Also, I've gone and set light grey to transparent so I can use white in some sprites, however when I put this in game the white I used in the sprites shows up as light grey, how do you set it to white outside of the tile editor?

Any help would be appreciated thanks.

UPDATE:

I've managed to get the background displaying (sort of) however it only shows up one sprite type instead of what its supposed to show.

Also, I still haven't worked out how to set white to non-transparent yet,

https://image.ibb.co/gA0Psa/Capture1.jpg

https://image.ibb.co/kG9vyF/Capture2.jpg

Last edited by jobalisk (2017-06-03 03:42:44)

Offline

 

#2 2017-06-03 06:21:33

Jonas
Member
From: Frankfurt, Germany
Registered: 2016-06-06
Posts: 112
Website

Re: help with background

To select another color than white as the transparent color, you have to set the sprite palette (OBP0 or OBP1) to the correct value.

Setting OBP0 to %11100001 will probably be correct in your case.

Offline

 

#3 2017-06-03 14:51:48

jobalisk
Member
From: I don't even know anymore...
Registered: 2017-05-28
Posts: 55
Website

Re: help with background

Thanks, any chance you could show me how to do that that in C?

Also, here's the code I'm using to load the background:

    set_bkg_data(0,255, groundTiles);
    VBK_REG = 1;
    VBK_REG = 0;
    set_bkg_tiles(0, 0, 20, 10, map01);
    SHOW_BKG;
    DISPLAY_ON;

Offline

 

#4 2017-06-03 15:33:18

Jonas
Member
From: Frankfurt, Germany
Registered: 2016-06-06
Posts: 112
Website

Re: help with background

Well, the code in C would be:

Code:

OBP0_REG = 0xE1; // $E1 = %11100001

The problem with the background is probably that you only load the upper 10 rows. Try this:

Code:

set_bkg_tiles(0, 0, 20, 18, map01); // 18 instead of only 10 lines.

Setting VBK_REG to 1 and immediately afterwards to 0 doesn't make much sense either but shouldn't be the cause for the problem.

Offline

 

#5 2017-06-03 18:32:05

jobalisk
Member
From: I don't even know anymore...
Registered: 2017-05-28
Posts: 55
Website

Re: help with background

Thanks, those both worked beautifully, I ended up setting it to 20, 20 as that was the background size.

https://preview.ibb.co/koZJkv/Capture3.jpg

Last edited by jobalisk (2017-06-03 18:32:27)

Offline

 

#6 2017-06-04 04:46:40

Jonas
Member
From: Frankfurt, Germany
Registered: 2016-06-06
Posts: 112
Website

Re: help with background

Good. smile But keep in mind that the Game Boy screen only displays 20 x 18 tiles. So the last two rows won't be visible unless you add vertical scrolling to your game.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson