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 2014-05-17 16:13:11

Imanolea
Member
From: Bilbao, Spain
Registered: 2014-05-17
Posts: 54
Website

Map scrolling with GBDK

Hi all,

I recently started a platform/action game for Game Boy with GBDK. Right now I'm working on the background scrolling.

The way I do this is the following.

The map is an array of characters representing 8x8 tiles. When as a result of the scroll the end of the background data is reached, the background data is reloaded using as index the displacement performed so far (the scroll is one way only).

For some reason I do not understand I am forced to do a reverse scroll with the displacement performed since the previous map loading before loading the map again. Otherwise, the map is loaded with scroll included. As a result, the method is as follows:

void loadmap(int scrlx) {

    scroll_bkg(-scrlx);
    set_bkg_tiles(0, 0, MTESTWIDTH, MTESTHEIGHT, &mtest[scrlx/8]);
}

The problem here is that making this reverse scroll causes a flicker, showing the background with the mentioned scroll applied for an instant, and I'd be interested to know what options I have to make the scroll correctly.

The truth is I have not been able to find much information about game development with GBDK and I would be very grateful if you could help me.

If you you detect some lexical irregularities in the text I'm sorry. English is not my native language.

Last edited by Imanolea (2014-05-17 16:13:42)

Offline

 

#2 2014-05-21 11:53:45

UraKn0x
New member
Registered: 2014-04-19
Posts: 7

Re: Map scrolling with GBDK

You can try to hide the background before loading your map and show it again when loading is done.

void loadmap(int scrlx)
{
    HIDE_BKG;
    scroll_bkg(-scrlx);
    set_bkg_tiles(0, 0, MTESTWIDTH, MTESTHEIGHT, &mtest[scrlx/8]);
    SHOW_BKG;
}

It generally prevents flickering.

Offline

 

#3 2014-05-21 12:10:07

Imanolea
Member
From: Bilbao, Spain
Registered: 2014-05-17
Posts: 54
Website

Re: Map scrolling with GBDK

Thank you UraKn0x but in fact, I already tried that. The problem persists with a flicker on white background.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson