Below you will find all of the code examples that I have written to date. Some of the larger functions used to be showcased at Coders Workshop, but there are also a few snippets that were not. I have tried to categorise these to make it easier for you to find what you want.
All of the samples below will work in Blitz3D and BlitzPlus, but as the language structure has changed dramatically in BlitzMax you won't find samples in all the downloads. The versions that a download will work for are indicated to the right of each sample's title.
Bitmap Fonts
 |
|
| Fixed width bitmap font |
3D / Plus / Max |
|
|
| A question often asked by the Blitz noobie is how to display a bitmap font. This short example, written for all three Blitz versions, shows just how easy it is once you get your head around the basics. |
|
|
|
 |
|
| Proportional bitmap font |
3D / Plus / Max |
|
|
| A bit more difficult then displaying fixed width bitmap fonts is displaying a proportional font. This example explains how to lay out the font image and then demonstrates how to load the font and create the width table internally, before going on to show how to display a piece of text. |
|
|
|
 |
|
| Fully justified text |
3D / Plus |
|
|
| Using a fixed width bitmap font, this function shows how to display one or more paragraphs of text that are fully justified. The function can either default to the width of the current screen resolution or it can take parameters if another part of the screen is preferred. |
|
|
User Input
 |
|
| Alternative Input() function using bitmap font |
3D / Plus / Max |
|
|
| Because the standard Input() function of Blitz is quite limited, programmers often find themselves needing to code their own. This function uses a fixed width bitmap font for user input and the function can take parameters for maximum width and the characters that can be accepted as valid input. |
|
|
 |
|
|
|
| Another way of getting a response from a program's user is to display a dialogue box on-screen to which the user then selects from a number of buttons with the mouse. Two examples are provided within the download, which show a simple yes/no dialogue box and another that can take any number of buttons. |
|
|
Scrolling
 |
|
| Scrolling tilemap demo #2 |
Max |
|
|
| This is a complete re-write of the tilemap demo below that has been specifically written for BlitzMax. Not much has changed in terms of calculating positions, but this one uses the entire screen to show the map and uses some of the new OOP features of BlitzMax. |
|
|
 |
|
| Scrolling tilemap demo |
3D / Plus |
|
|
| A great proportion of games today use levels that are larger than the screen area, which are usually comprised of tilemaps. These routines demonstrate how to go about scrolling such a level while keeping the main character central, but also has a little bit of parallax scrolling for good measure. |
|
|
Game examples
 |
|
|
|
| Based on the same idea as Disc Invaders (below) this basically serves as a demo/tutorial on making a Space Invaders clone. Apart from being coded in BlitzMax, this version uses its own pre-rendered graphics and sound effects. It also includes a savable high score table. |
|
|
|
 |
|
|
|
| Questions that usually pop-up are more often than not related to some part of the programming of a Space Invaders clone. This program was put together to answer most of those questions, including moving the alien formation, fire control and a parallax star field. |
|
|
|