Projects and files
A game is a project: a folder of files. There’s the code, and then everything the code loads: pictures, maps, scenes, sounds, songs. The IDE shows them all in the file list on the left.
Making a project
On your computer, a project is just a folder. Make one wherever you like, open it in the IDE, and its name goes at the left of the toolbar.
In a browser, the project’s name at the left of the toolbar is a menu. It lists every project the browser keeps, with:
- New project…, which asks for a name and makes it,
- Rename project…, for the one that’s open,
- a row for each project, to open it here or in another tab, and a bin to delete it.
Deleting a project in the browser deletes it forever, so export it as a
.crashcart first if you might want it again (Building and sharing shows
you how).
Crash-tan’s Tip: A project can only be open in one tab at a time, so two tabs can’t both change it. Open it in a second tab and the IDE tells you, and offers you another project instead.
The first file
A new project is empty, so the IDE asks what your game is written in:
| Language | Its main file |
|---|---|
| Crash BASIC 2 | main.crash |
| Crash BASIC | main.bas |
| Python | main.py |
| Lua | main.lua |
| JavaScript | main.js |
Pick one and click Create, and you get a main file with a little program in it already, one that runs. In Crash BASIC 2 it’s this:
SCREEN 320, 240
PRINT "Hello from Crash BASIC 2!"
PRINT "Press any key to finish."
PAUSE
Press F5 and it runs. That’s a game! A small one.
The file list
Click a file to open it in a tab. Right-click a file, or the empty space under the list, to make something new:
- New code: a code file in any of the five languages,
- New map…, New scene… and New atlas…,
- New song… and New instrument bank…,
- New picture…, New file… and New folder….
Each new kind of file starts as one that works. A new picture asks for its
size, and whether it’s an Aseprite picture (.ase) or a PNG.
Right-click a file for Rename… and Delete… too. To do the same to lots of files at once, Ctrl-click (Cmd-click on a Mac) or Shift-click to pick them first. Drag files onto a folder to move them there, and drag files in from your computer to add them to the project. If one has the same name as a file that’s already there, the IDE asks before it replaces anything.
Pictures in the file list show a little picture of themselves. Turn that off with Show pictures in the file list in the right-click menu.
Two ways to see a file
Lots of a game’s files are JSON: maps, scenes, songs, instrument banks. Those open in their own editor, with a switch above them to see the same file as Text. Edit either one, and the other follows.
A picture opens as a Preview, with switches for the Sprite Editor and the Tile Editor. A sound file shows its wave, and you click it to hear it.
Saving
Save in the toolbar (Ctrl+S, or Cmd+S on a Mac) saves every file with changes. Each editor (pictures, tiles, maps, scenes, songs, instruments, databases) has a Save of its own too, in the bar along its top, which saves that file alone. Running your game saves everything first, so the game always runs what you see. Close a tab with changes in it, or the IDE, and it asks whether to save them.
A browser project and a folder
In a browser that lets a page use a folder on your computer, the project menu has Connect a local folder…. That keeps the project in step with a folder on your computer:
- Sync now goes both ways: each file goes the way it changed, and if it changed in both places, the folder’s wins.
- Pull brings in the folder’s new and changed files, and sends nothing out.
- Push all… writes every file to the folder, over what’s there.
- Auto-push changes writes each change to the folder as you make it, until you reload the page.
- Disconnect stops.