11 March 2016 - Forum Rules

Main Menu

GBDK set_bkg_tiles

Started by Guadozoku, December 24, 2014, 02:18:57 AM

Previous topic - Next topic


I'm really having it out with this function. I got a scrolling thing going with collision detection, but I'm VERY limited now. I can't choose where I want to set the player or load any part of the map besides the top left. I can just put the player sprite where I want of course, but I'm trying to be somewhat professional about this, so I'm sticking it in the middle of the screen (at 72,72) and moving the map around it, like a GB game or the ship on Futurama.

The command is: set_bkg_tiles(0, 0, 50, 50, Testmap);
The first 2 are the tile axes to place the map,
the second two are the size of the map
Testmap is the name of the map

The problem is that if I change the first 2, I just get garbage in some parts of the screen. If I change the second two, the whole map is warped. I've seen people point to a certain point in the Testmap array, like Testmap[50], but for some reason that screws up what tile is loaded in what spot.

I'm pretty sure that this is the biggest hurdle for a LONG time in learning GBDK (except for sound, which I'm leaving for last and dreading) Can anyone help?


Use the scroll registers and edit the tilemap data. Don't mess with the call that you have there, all it does is copying the tilemap. The tilemap already starts at the correct spot.


How do I use the scroll registers? I'm not even sure what those are.


The scroll registers control the position of the background in the viewport. They are typically used to erm, scroll it.


I'm very new to console programming. How do I access that in the c compiler?