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.
Hi, I recently found the wiki of this site and i'm trying to learn the basics of GBDK to make a video game for GB.
I have read this tutorial How to Write a Simple Side Scrolling Game in GBDK Written Really F**king Simply (sic) which is very interesting, but copying the source code of the tutorial and compiling it I got a game which shows the background map, but no sprites.
Changing some lines of code i found that adding an empty print in the function DoGameplay() the sprites are visible and the game actually works, but in this way the background map is not visible.
void DoGameplay(void) { Playing = 1; //Sets the UBYTE playing to 1, indicating that the game is playing. while(Playing == 1) { //This starts a loop so that while playing is equal to 1, the loop will continue to loop. If playing does not equal 1, the loop will stop. //Repeat the following steps for the game to play. UpdateJoypad(); //This procedure checks the joypad, and moves the players ship according to the results. It also updates the player's shot, if it has been shot, for lack of a better place of sticking it. UpdateBadGuy(); //This procedure moves the enemy. CollisionDetection(); //This is one of the most important procedures. It checks to see if the player has collided with the enemy, along with the player's shot colliding with the badguy. delay(10); //This is the game's master speed control. It doesn't affect the background scrolling, but does affect the badguy's speed, as well as how responsive the controls are. printf(" "); } }
How can I resolve this? I can post some parts of code if needed.
Offline
If adding a delay is changing graphics, then that probably means VRAM is being written to outside of VBlank/HBlank.
Make sure that the background and sprite updates happen immediately after VBlank starts, and that the CPU isn't doing more work than it has time for. BGB's CPU meter and VRAM visualizer can help you debug this.
Offline