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.
I have a trouble designing in Gameboy Map Builder because even when I set 42 the width and my code looks something like that:
#include <gb/gb.h>
#include <stdio.h>
#include "fondotiles.c"
#include "Mapa.c"
void main(){
set_bkg_data(0, 14, Mapatiles);
set_bkg_tiles(0, 0, 42, 20, Mimapa);
SHOW_BKG;
DISPLAY_ON;
while(1){
scroll_bkg(2, 0);
delay(10);
}
}
It doesn't show all the map, it only shows to from 0th to 31th column, and I don't know how to solve this problem.
Something, I could add is that I still don't know how to use properly the Gameboy Map Builder because I've only watched a video of YouTube from a course of Gameboy Programming using C language and in the video the guy that is making the process looks like everything works well for him. But once I try it, it simply doesn't run correctly for me
I hope one of you can help me eather if the issue is in the code or is in the misuse od Gameboy Map Builder. I really would appreciate your help. I'm just a rookie programmer and I'm very keen on making a Gameboy game to play it in my portable device.
Offline
My guess is that it's because the Game Boy's tilemap is limited to 32x32. If you want a larger map (e.g. a 42x20 map), you'll need a variable to keep track of the camera's x, and whenever you scroll the background you'll need to update that variable and you'll also need to swap the offscreen tiles relative to the camera
(e.g. game starts with the camera on column 0, so after 4 scrolls you'd increment camera_x, which means you'll need to change all the tiles in column 0 (=column camera_x-1, i.e. the offscreen column directly to the left of the camera) to display the tiles for column 32 (=camera_x+31)... and after 4 more scrolls you'll again need to increment camera_x and change the column 1 tiles (=camera_x-1) to display the tiles for column 33 (=camera_x+31)... and so on, so that by the time the camera wraps back around then you'll be seeing the correct tiles)
It's kind of hard to explain, so sorry if I'm not clear. I'd post some example code but I don't use GBDK (not to mention I'm new and am not sure what the most efficient way of doing this would be)
I'm sure somebody else knows...
Last edited by h0tp3ngu1n (2020-01-22 18:23:39)
Offline