-
-
Notifications
You must be signed in to change notification settings - Fork 488
Code Editor
TIC-80 includes a powerful built-in code editor to assist with game development. It's entirely possible to design, code, and maintain a game without ever leaving the TIC-80 environment.
On top right of the code editor several buttons allow to:
- Switch font. The code editor uses two fonts and allows to switch from the default larger font to the alternative smaller one.
- Show shadow of the font.
- Run cart (hotkey: CTRL+R).
- Drag tool.
- Find provided text.
- Go to line number provided.
- Show Bookmark list.
- Show code Outline.
Colors used in the code editor can be customized using the configuration file.
It is good practice to start cartridges by the metadata tags. In particular, the script
tag is required when another language than Lua is used for the virtual machine to know.
At the core of every game is a loop that updates the game and renders new frames. In TIC-80, this is managed by the TIC()
function:
-- # Metadata Tags:
-- title: game title
-- author: game developer, email, etc.
-- script: lua --required to run cart if not lua
-- # Code outside TIC() runs once at program start.
-- Declare variables, functions, initialize
function TIC()
-- # Code inside TIC() runs ~60 times per second.
-- Handle inputs, update game state
cls() -- Clear the screen
-- Render graphics, characters, objects, backgrounds, etc.
end
Look at the Hello World cartridge as an example of TIC-80 code.
Note: Clearing the screen at every frame is not necessary but avoids annoying artifacts.
Please see API Reference for a full list of built-in functions or to download a quick function reference cheat sheet.
CTRL+F Find.
CTRL+G Go to line.
CTRL+P/N Move to previous/next line.
CTRL+F1 Bookmark current line.
F1 Move to next bookmark.
CTRL+B Show bookmark list.
CTRL+O Show code outline.
RIGHT CLICK Drag.
CTRL+TAB Indent line.
CTRL+SHIFT+TAB Unindent line.
CTRL+/ Comment/Uncomment line.
The general hotkeys are available in the code editor too.
The PRO version allows to use an external editor to write your code, if that is your preference.
TIC-80 tiny computer https://tic80.com | Twitter | Telegram | Terms
Built-in Editors
Console
Platform
RAM & VRAM | Display | Palette | Bits per Pixel (BPP) |
.tic
Format | Supported Languages
Other
Tutorials | Code Snippets | Libraries | External Tools | FFT
API
- BDR (0.90)
- BOOT (1.0)
- MENU
- OVR (deprecated)
- SCN (deprecated)
- TIC
- btn & btnp
- circ & circb
- clip
- cls
- elli & ellib (0.90)
- exit
- fget & fset (0.80)
- font
- key & keyp
- line
- map
- memcpy & memset
- mget & mset
- mouse
- music
- peek, peek4
- peek1, peek2 (1.0)
- pix
- pmem
- poke, poke4
- poke1, poke2 (1.0)
- rect & rectb
- reset
- sfx
- spr
- sync
- ttri (1.0)
- time
- trace
- tri & trib (0.90)
- tstamp (0.80)
- vbank (1.0)