Skip to content
Download

Your first game

In this tutorial you will make a spaceship game from scratch: you control the ship, shoot the enemies that fall, score points and lose lives. When the lives run out, the game over screen shows up.

The finished game: the ship at the bottom, two red enemies, and the PONTOS (score) and VIDAS (lives) display in the corner.
  • Create a project and import images and sounds.
  • Create objects, give each one a sprite and place them in a room.
  • Write the behavior of an object in C++: move, shoot, collide.
  • Create variables and actions in the editor and use them in the code.
  • Create enemies from time to time and count points.
  • Show text on screen and switch rooms.
  1. Project and sprites: create the project and import the images.
  2. The ship: the ship appears and moves with the arrow keys or the gamepad.
  3. Shots: the space bar shoots.
  4. Enemies: enemies fall and explode when shot.
  5. Score and lives: scoreboard, lives and damage.
  6. Sound: sounds for shooting, explosion and damage.
  7. Game over: the Game Over screen and playing again.

Each part takes some 10 to 15 minutes and ends with the game running.

  • Install Brasa: see Installation.
  • Have a code editor. We recommend VS Code with Microsoft’s C/C++ extension: Brasa already sets up the project so autocomplete works.
  • Download the images and sounds of the game: primeiro-jogo-recursos.zip. Unzip it into any folder.