# Your first game

# This document is in development!

M lets you write the logic of your game independently of the design and art of the game. You can write your game mechanics and then the designers will mix the mechanics they like with the art the artists provide.

Shoot them up. We will use an iterative approach were we keep adding features one by one. A feature includes data and interaction, so we must edit the entities and systems that exist in the world to add a new feature.

But first, let's extract all the features we desire in the core game loop of our game.

# Feature extraction

  • Control the character.
  • Create hazards over time.
  • Move hazards.
  • Destroy the character when a hazard hits it.
  • Clear the hazards when they leave the screen.
  • Shoot projectiles.
  • Destroy hazards using projectiles.

Note that the words used are consciously vague, as the game won't have any art direction for now. The character could be a car, a spaceship, a superhero or a dolphin. The hazards could be asteroids, tanks or chickens.

# Create a folder

Do it with the keyboard:

  • Press Control+Shift+P
  • Type new file
  • Press Enter
  • Type Hello.m
  • Press Enter
  • Type this
  • Press Enter


  • Bullet

# Create a file

We will code all the mechanics in a single file

Click file
Click new file
Type main.m
Click ok

# Controlling the character

Linear motion proportional to the input read.

    foreach a
        a.velocity = a.direction * a.speed