# A first game

About twenty minutes. No programming. At the end two people can play it on a BBS.

## 1. A project

Start DoorBench. **New project**: call it *Cave Town*, put your name in, choose a folder, and
start from *nothing: one place*. **Save** (Ctrl+S) whenever you like; **Undo** takes back
anything.

## 2. Two places

The **Flow** tab shows one place, `home`. Press **New place** and call it `cave`. Drag the dot
on the right of `home` onto `cave`. A line appears: that is a choice that leads there. `cave`
already has a choice back.

## 3. Something to own

Open **Fields**. Players have `cash` already. **Add a field**, call it `bread`, and leave it a
number. Then open **Modules**, press **Use modules in this game**, tick nothing yet, and press **Add a shop**. Name it `store`,
title *The store*. **Add goods**: label *Bread*, field `bread`, price to buy `3`.

Open `home` (double-click it in Flow). **Add a choice**: key S, label *Store*. Under it,
**+ Add a block**, *Group*, *Call a function*, and choose `store`.

## 4. Somebody to fight

**Add**, **Table**, call it `beasts`. Leave it *fixed*. It has a field `name`; add `hp`,
`attack` and `money`, all numbers. Add three rows:

| name | hp | attack | money |
|---|---|---|---|
| A cave rat | 6 | 2 | 8 |
| A bat | 4 | 1 | 5 |
| A blind lizard | 12 | 3 | 20 |

In **Modules**, **Add a fight**: name `hunt`, opponents `beasts`, *They hit*
`f.attack + random(-1, 1)`, *Money won* `f.money`. Tick *Something that heals can be used*:
how many is in `bread`, called *some bread*, heals `5`.

Open `cave`, **Add a choice**: key H, label *Hunt*, calling `hunt`.

## 5. A step of your own

Still in `cave`, add a choice: key L, label *Look around*. Add these blocks under it:

- *Change, Spend*: `1` from `player.turns`.
  - if there was enough: *Decide, By chance*, `30` in 100:
    - then: *Change, Add* `random(1, 6)` to `player.cash`, and *Show, Say*
      `You find some coins. You have {player.cash}.`
    - otherwise: *Say* `Only stones.`
  - if not: *Say* `You are too tired today.`

## 6. Play it

Press **F5**, then **Play as Ann**, and click the screen. Press **Play as Bob** too: both are
in the same world. On the right you can look at values and change them. **Next day** gives
everybody their turns again.

If something is wrong it is listed at the bottom; click it to go there.

## 7. How a day in the month will feel

**Balance** plays the game with simulated players. Run it, and look at cash by day.

## 8. Give it to a sysop

In **The game**, fill in the version, author and licence. **Guides**: add one called `player`
and say how to play. Then **Game > Make packages**. Each ZIP has everything a sysop needs,
and SYSOP.TXT says what to do with it.
