Rad stuff, thanks a bunch for doin' this.
Menu/Inventory System for GB Studio
|Movement --->||D-Pad||Arrow Keys|
|Selection/Cancel --->||A / B||Z / X|
This template and tutorial allow you to build your own Menu & Inventory System in GB Studio.
Below are downloadable files that contain the Menu template, to open in GB Studio.
The following video tutorial explains all about it, you can watch it here:
If you prefer reading instead, here are the steps to follow:
Open GB Studio;
- Add a scene that will work as a base world map;
- In this first Map scene we'll set our Menu call for when we press Start (Attach Script on Button Press);
- Now add a Remove Attached Script, (activate all buttons, this will prevent loops from happening between its options)
- Now Store Current Scene on stack (Saving the Scene on stack allows you to switch scene and have your player's x,y coordinates saved, useful because then you don't depend on a fixed player position on start);
- Next, Add a Scene for the Main Menu;
- Then Switch scene to the Main Menu scene;
- Hide player;
- Immobilize player with Collisions, so that he doesn't move;
- Attach script for presses: UP, DOWN, A and B:
9.1) on UP press: Inventory:
- remove script from input;
- store current on stack;
- add and switch scene to inventory scene;
- change Player sprite to cursor and Movement speed to 2;
- use Actors or Triggers as items:
- If using triggers:
- Set script to button A;
- Remove all scripts except B (to keep the 'Resume' function);
- Make a check if player at X,Y position = item X, Y values (this makes sure that the trigger doesn't just trigger when you hover over it);
- Add dialogue or something - 'you chose item 1!';
- If using actors:
- (optional) Hide Actor associated to Item 'x'
- (optional) You can then use Variables (True and False) to set whether the Actor: Item 'x' is shown or not.
- Just add some dialogue, make sure the actors are set as Static;
- Mind the collisions when designing the menu using this method;
- Before Continuing:
- Don't forget to return player speed and sprite to normal;
- Attach script to B press - Restore previous scene from stack (returns to the previous Main menu scene);
9.2) on DOWN press: Configurations:
- Remove script from all inputs;
- Store current scene on stack;
- Add and switch scene to the configurations scene;
- On the configurations scene, lets just immobilize the player with collisions and have a Attach script to Button on B press: ;
- To go back to the main menu, use Restore previous from stack;
9.3) on A press: Save:
(This we can do without having to add a new scene, but the Saving event must be run on the MAP Scene, not on the MENU scene, otherwise the game will load on the Menu screen;)
- Inside the 'Attach script on Button Press: A, start by creating a remove script for all inputs;
- Add some Dialogue 'Saving ... Please don't turn system off, etc';
- After that create and set a new Variable: 'Saving' to True;
- Restore to first scene on stack to return to the Map Scene;
- ON THE MAP SCENE - In here we check if the player has just SAVED in the Main Menu scene, using a script for 'If Variable: 'Saving' - True';
- Only then, inside that 'if true' check, do you add the 'Game Data: Save' event;
9.4) on B press: Resume:
- Remove script from all inputs;
- Restore to First scene on stack;
I hope that was helpful and simple enough, DM me at discord if you have doubts.
I'd like to credit the dev Team of GBStudio, and I heartily recommend it.
Feel free to use any assets, just give credits all around!
|Updated||23 days ago|
|Tags||Game Boy, gb, gbstudio, gb-studio, menu, studio, system, toxworks, tutorial|
|Asset license||Creative Commons Attribution v4.0 International|
|Average session||A few seconds|
|Inputs||Keyboard, Mouse, Smartphone|
|Accessibility||Subtitles, Configurable controls, Interactive tutorial|
To play the ROM:
Open the .gb file with a ROM Emulator.
To use the template:
Make sure you are using the latest Developer Version of GB Studio Found here:
64bit - https://circleci.com/api/v1.1/project/github/chrismaltby/gb-studio/latest/artifacts/0/builds/gb-studio-develop-windows_x86_64.zip?branch=develop&filter=successful
32bit - https://circleci.com/api/v1.1/project/github/chrismaltby/gb-studio/latest/artifacts/0/builds/gb-studio-develop-windows_x86.zip?branch=develop&filter=successful
Copy the zipped folder over to a directory in your computer, unzip and then open the 'Menu' folder. Open the .json file inside using GB Studio.
There are two version, the Eventing version and the Scripted version.
The Scripted version uses the new Custom Code blocks, and so it's easier to copy over from project to project.