Empty Your Mind Tutorial 1

This tutorial will teach you how to use the SwinGameSDK to develop a simple danmaku game which looks cool. At the end of this tutorial you should be able to use pascal to implement your own space invaders or scrolling shooter style game which makes use of Vectors, animated Sprites, SoundEffects, and Music.

You can view the final product on the Empty Your Mind page. This includes a promo video, screen shots, and a download of the completed game as an executable and as source code.

Things You Need

 * Motivation to create a game.
 * Knowledge of procedural programming.
 * Some knowledge of Terminal.
 * Free Pascal Compiler
 * Image manipulation program (preferbly Photoshop but Gimp is also good)
 * Text editor with syntax highlighting:
 * Windows: Crimson Editor
 * Macintosh: TextMate or Smultron

Starting The Project
You will need to download the latest version of SwinGameSDK for FPC. In this tutorial, I will be using Macintosh version of SDK. You can obtain a copy of SDK from the Download page.

Compiling The Game
The game can be compiled by using the script which comes with the SDK. The script is called macbuild.sh which can be executed from Terminal. Make sure that macbuild.sh has proper permission. If not, run "chmod a+x macbuild.sh" in the Terminal. To compile the game, you will need to specify the name of the game. In this tutorial, I will call it EmptyYourMind (don't ask me why because it is a long story…).

Run ".macbuild.sh EmptyYourMind" from Terminal to compile the game. Test if the game starts by running EmptyYourMind.app in bin folder.

Structuring The Game
We need to setup a simple data structure to manage the game data. In my game, I will have a ship data and a game data. Ship data will contain its sprite, speed and other information. The game data will contain all data used in the game, such as a background sprite and player's ship. To implement this, we need to define the type. The following code will define the initial type definition. I will be adding more entries when I need to. Therefore, the basic program structure should look like this. In this program structure, the Main procedure calls the MainGame procedure. The MainGame procedure contains the GameData which contains the game data including the player.

Summary
In this tutorial, I have gone through:
 * How to prepare the game
 * How to structure the game