-
-
Notifications
You must be signed in to change notification settings - Fork 489
Tips for newcomers
People learn in different ways, and some enjoy finding things out on their own. This page aims to have the most important information everyone needs to begin well, a few tips that are easy to miss, not more.
If you are new to programming, have a look at the beginners tutorials instead.
TIC-80 has a native screen resolution of 240 pixels wide by 136 pixels tall. The screen origin is at top-left, with x coordinates running left to right and y coordinates from top to bottom.
Here are some essential console commands:
`new lua` Create a new cart using Lua (works with lua, python, ruby, js, moon, fennel, scheme, squirrel, wren, wasm, janet).
`save mycart` Save and name the cart as "mycart" (Hotkey: CTRL+S).
`run` Run the cart (Hotkey: CTRL+R/ENTER).
`folder` Open the working directory in OS, where TIC files are saved.
`surf` Open carts browser.
`eval` Execute provided code.
Find more console commands here.
To log the results use trace:
>eval trace("Floor division of 32 by 10 is "..32//10)
Floor division of 32 by 10 is 3
Note: Run a cart first to launch the virtual machine; otherwise, eval
will output an empty string no matter what you do.
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
-- # 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
Note: Not clearing the screen at every frame can result in annoying artifacts.
Use trace in your code for debugging:
trace("x = "..x) -- Prints the value of x to the console
Useful hotkeys:
ESC Switch between console/editor or open menu while in-game.
ESC+F1 Switch to editor while in-game.
F1/F2/F3/F4/F5 Show code/sprite/map/sfx/music editor.
CTRL+R/ENTER Run cart.
CTRL+S Save cart.
CTRL+O In code editor: show and navigate outline of code. One of the best ways to navigate through code in TIC-80.
Explore TIC-80 on the wiki, along with several tutorials. Additionally, you can use the help
command in the console.
You can start by learning about print, spr, and btn to understand the Hello World cartridge.
If you struggle to find something on the wiki use github search bar with "Wikis" filter.
If you have specific questions, you can find assistance on the discord, which is an active community, or on telegram, itch.io and github.
To quickly grasp the basics of Lua, this tutorial serves as an excellent introduction, if you already know programming.
Note: %
is modulo and //
floor division.
Here is a cheatsheet by Skye Waddell.
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)