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 2016-07-26 09:11:39

kluxos
New member
Registered: 2016-07-26
Posts: 1

understanding the GBDK (graphics, layers,ets...)

hey guys im new here im an artist but i have a little knowleg fo programming i start working on the GBDK and i got some issues (i start working on a title screen)

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
the first issue is ---------> i made a background image in the title screen and when i try to make the (PRESS START) button (i use the gprintf() and the gotogxy()) the background desapeart and i got glitches i dont know why i start making some searches and i want to try to use sprites instade of the printf() i dont know how to make a sprite that containe muliple sprites (ex sprite for (P) end other for (R) and for(E) and for (S)and for (S) and so on ....
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

the second issue is ---------> HOW CAN I CREAT SCENS AND SWITCH BETWIN THEM FOR EXAMPLE WHEN I PRESS START THE TITLE SCREEN SHOUD DESAPEARD AND INITIATE THE INTRODACTION OF THE GAME AND WHEN I PRESS START AGAIN OR WHEN THE INTRODACTION FINISHED SWITCH TO THE IN GAME SCENE OR IN OTHER WAY START THE STORY (IM WORKING ON A RPG GAME LIKE FINAL FANTASY AND DRAGON WARIOR ETS...)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

the 3ed issue is ---------> how can i creat a TEXT MESSAGE BOX like in the rpg games  and how can i creat a GUI (graphique interface) in the GBDK like widows and buttons ets
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

and thanks
sorry for my bad english

ps = guys! WHY THERE IS NO ADVANCED TUTORIALS FOR THE GBDK !!! peoples need tutorial for the GBDK

Offline

 

#2 2016-07-27 10:42:38

holtkamp
Member
From: Orlando, FL
Registered: 2016-06-23
Posts: 14
Website

Re: understanding the GBDK (graphics, layers,ets...)

Hi Kluxos,

I actually have never used GBDK, but I'll try to help.

First issue: It looks like you are using the correct functions for drawing text. Are you calling these functions after you wait for vblank? As long as you are in the vblank section of the lcd refresh cycle, you can freely edit the background and tiles. Or if the lcd is turned off, then you have all the time you want to draw on the background. I think display_off() should turn off the lcd. Drawing text on the background is usually the easiest way to go. Using sprites lets you move the text around wherever you want, but you need to write code to manage multiple sprites for a string of text. Like you said, each letter needs it's own sprite, so you would need to call set_sprite_tile() and move_sprite() for each letter. Also, you can only have 10 sprites in the same row or else some of the sprites will start to disappear. This is a limitation of the gameboy hardware.

Second issue: I would use a variable to keep track of the state of the game. When the player hits START at the menu, then you should turn off the display, load the tiles and map for the intro scene, then turn the lcd back on and change the state of the game from MENU_STATE to INTRO_STATE (or whatever you want to name your game states). In your game loop you would check what state you are in, and then call the correct functions.

For instance
if (gameState == STATE_MENU)
{
   UpdateMenu();
}
else if (gamestate == STATE_INTRO)
{
   UpdateIntro();
}

etc

So in your update Menu function you would check to see if the player has hit the start button to transition to the intro state. In the UpdateGame() function you would write code that checks if the player is pressing direction buttons and to update the location of the player.


Third Issue: For text boxes, you should probably use the gameboy's Window feature. The window will render on top of the background if it is enabled. So when you talk to an npc you should enable the window. I think      SHOW_WIN does this.  I've never used the window function yet, but I think you set an x and y position and it offsets the window to that location. I do not think you can set a width or height, but I could be wrong. So in that case you would have to put the window toward the bottom of the screen. That is usually where it is in RPGs anyway.


I hope that helped a little. Oh also, if you are using the BGB emulator it has a really awesome VRAM window that will show you the tiles you have loaded, and the background/window maps. It even updates in real time as you are playing the game. It is so helpful!

Offline

 

#3 2016-07-28 07:30:55

rychan
Member
From: Paignton, Devon, UK
Registered: 2015-12-16
Posts: 103
Website

Re: understanding the GBDK (graphics, layers,ets...)

Here's some quickie, commented demo code for you to help you get started kluxos.

https://refreshgames.co.uk/wp-content/u … dkdemo.zip

Re-iterating holtkamp, BGB is by far the best emulator to use when developing.

Hope this helps you out.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson