Template Project
The Dorky Demustard game starts with the GB Studio Sample Project (GBS 1.0). This is described as "A short 4 color top down game".
Give your project a name and path, then click Create Project
You may download the final project zip file here:
Default Game World
Here's the default Game World view from the template. You can see the eight scenes available as well as their connections.
For example, the Logo scene flows to the Title Screen scene which then flows to the Outside scene when the player presses Start
.
The Game Boy screen is 160 x 144 pixels. A game tile is 8 x 8 pixels, the smallest unit that fits into graphic memory. So, a single screen level is 20 x 18 tiles.
Scene Pruning
To create Dorky Demustard, we'll delete a few un-needed scenes an adjust the scene flow.
The Outside scene is large, 32x32 tiles (a tile is 16x16 pixels). It covers roughly 4 times the area of the Game Boy screen, which means the game camera pans and scans as the character moves.
Click and drag the player start icon from the Outside scene to the House scene.
Then, click and delete the Outside scene, we won't be using it.
In fact, let's get ruthless -- delete the Stars and Underground scenes, too!
Testing
Try out the game now by clicking the Game > Run menu item.
The game compiles and you can then play it using keyboard keys (arrow keys
+z
will get you pretty far) .
Testing
Try out the game now by clicking the Game > Run menu item.
The game compiles and you can then play it using keyboard keys (arrow keys
+z
will get you pretty far) .
You may notice that if you try to walk through the doorway you don't go anywhere. Stuck! Next, let's create a trigger to move between scenes.
Quit the emulated run test.
Trigger
Click the orange Trigger block in the House scene doorway.
In the properties panel select the Cave scene from the drop-down menu. This will add a player position connection to the scene. You can drag it where you like and adjust the direction arrow in the properties panel.
Now, if you test the game, walking to the door in the House scene will trigger moving the player Actor to the Cave scene.
Return Trip
Repeat this process to set the Cave door trigger to send the player Actor back to the House scene.
Room Backgrounds
The process of designing your levels can be a back and forth between the pixel art and level functions, such as collision areas and triggers. Let's swap in a couple of backgrounds now.
Asset Folders
Since we started with the sample project we have a number of pre-made assets to work with. Save your projects and head to the project directory to find the assets > backgrounds
folder.
House Art
Open the house.png file in your pixel editor (Aseprite shown here).
Feel free to draw a new background, add to the existing one, or add designs from a downloadable asset pack, such as the one I purchased, the DVA tileset Town 'n' Around. (You can also find free sets, but I thought this one was great and was happy to pay for it.)
Layers
Work with layers in your pixel editor so you can move elements around to arrange them just so.
Save your file as a PNG file named living_room.png in the backgrounds folder. You can download the one I made below if you like.
Swap BG
In GB Studio, click on the House scene and then pick the new living_room
option from the drop-down in the Background section as shown here.
Delete the four sign sprites, we won't be using them, then use the Eraser and Collision brushes to fine-tune the wall and object collisions.
Lars
Swap out the Actor1
sprite for the lars.png attached below, placed in the assets > sprites
folder of your project directory.
You can reuse some of the previous settings, but adjust them for your game. I've set Lars's dialog to display "Lars: You should play some music."
You can also check out the GB Studio file for the project to see how the $Gotbattery
and $Gotcassettetape
variables are used to determine which text prompts to display.
Bedroom
We convert the sample Cave scene into the Bedroom -- this is the second scene the player can enter. Check out the GB Studio project to see how the trigger heads back to the Living Room scene.
You'll also see two sprites to interact with -- the Battery
and the Tape
.
Actor Interactions
The Battery
actor is set to interact with the Player
when there is an "On Hit" collision. This causes a sound effect to play, a text display to pop up, the Deactivation of the Battery
, and the $Gotbattery
variable state to flip to True
.
The Tape
actor is initially out of reach. When the battery has been grabbed, the Tape "On Update" loop sees the change in the $Gotbattery
variable.
This causes the Tape
to Self Move To{} a location on the screen where it can be reached.
Boombox
Pick the radio Actor2
sprite that was in the sample scene and swap out the sprite art for the boombox2.png using the same method as we did with Lars.
Again, we will use the $Gotbattery
and $Gotcassettetape
variables to create the logic for dialoge box display.
When those two conditions have been met, with batteries and tape in hand, the Boombox
will play upon interaction! Just walk up to it and press A.
You'll see in the GB Studio project that when both variables are true (after collecting the necessary battery and tape objects) a Play Music Track event launches a song. We'll have a look next at the music tracker interface.
Music Tracker
Click on the GB Studio mode dropdown to switch from Game World to Music.
This is where you can create four track music, using a spreadsheet-like interface called a music tracker. Rather than re-invent the wheel, check out the excellent GB Studio docs on the music editor here.
There are four different tracks for different intstruments (two PWM, one waveform, one noise, often used for drums and percussion) which correspond to the four synth tracks of the Game Boy hardware.
The tracker represents time vertically, with 1/8th note steps. Here we can see and hear a bass line playing on Duty 2 with an A#, G#, D# pattern, and the drums on the Noise track.
End Game
We use the glass actor to end the game. On Hit will cause a two-choice menu dialog box to pop up.
The Continue choice will close the menu and make no changes to game state.
By picking the Quit choice, the following happens:
- Stop Music event stops the music
-
$Gotcassettetape
variable is set back toFalse
-
$Gotbattery
variable is set back toFalse
- Change Scene is set to the game title screen
The game is now ready to be played anew, with everything put back in its place!
Text editor powered by tinymce.