New to basicFusion? This short guide takes you from a blank screen to your first moving pixels. No installing, no setup - just open the editor and type along. When you want the full command list, head to Documentation.
Go to Create, click â Create New Project, give it a name, and the editor opens. Type code on the left, then press the âļ Run button to see it come alive. That's the whole loop: type, run, repeat.
Every program can start with one line. PRINT writes text to the screen.
PRINT "HELLO, WORLD!"
â HELLO, WORLD!
A variable is a named box that holds a value. You make one just by assigning to it - no special keyword needed. Numbers go in plain names; text goes in names that end with a $.
SCORE = 100 ' a number NAME$ = "Ada" ' text ends with $ PRINT NAME$ PRINT SCORE + 1
â Ada
â 101
SCREEN switches from text to a pixel canvas - you give it a width and height. CLS clears it. Then you can draw: shapes take an (x, y) position and a colour written as text.
SCREEN 320, 180 ' a 320x180 canvas CLS CIRCLE (160, 90), 40, "magenta" PSET (160, 90), "cyan"
â a magenta circle with a single cyan pixel in the middle
A FOR ... NEXT loop runs the same lines over and over, counting as it goes. STEP sets how much the counter jumps each time. Here it draws a set of rings.
SCREEN 320, 180 CLS FOR R = 8 TO 80 STEP 8 CIRCLE (160, 90), R, "cyan" NEXT R
â ten cyan rings growing outward from the centre
IF ... THEN only runs something when a condition is true. This is how games check for a win, a collision, or - here - a game over.
LIVES = 0 IF LIVES = 0 THEN PRINT "GAME OVER"
â GAME OVER
When you animate, you clear and redraw the whole screen dozens of times a second. If every shape appears the instant it is drawn, the picture flickers - you catch it half-finished. FASTGRAPHICS fixes that: it turns on double buffering, so your drawing goes onto a hidden page nobody can see yet.
Nothing shows until you call SYNC. It flips the finished page onto the screen in one go, clears the hidden page for the next frame, and paces the loop to a steady frame rate. So the recipe for any animation or game is always the same three parts:
SCREEN 320, 180 ' 1. size the canvas FASTGRAPHICS ' 2. turn on double buffering (once) r = 10 DO ' 3. draw a frame, then SYNC - forever CLS CIRCLE (160, 90), r, "cyan" r = r + 2 IF r > 90 THEN r = 10 SYNC LOOP
-> a ring that grows and restarts, perfectly smooth
Paste any of these into a new project and press Run. Change the numbers, swap the colours, break things on purpose - that is how you learn. Every command here is explained in full in the Documentation.
Two loops walk every pixel and colour it with RGB. Your first full-screen image.
SCREEN 320, 180 FOR y = 0 TO 179 FOR x = 0 TO 319 PSET (x, y), RGB(x, y, 128) NEXT x NEXT y
SIN plus TIMER makes it move; SYNC shows each frame. A classic scene effect in a few lines.
SCREEN 320, 180 FASTGRAPHICS DO CLS FOR x = 0 TO 319 y = 90 + SIN(x / 18 + TIMER * 3) * 60 PSET (x, y), "cyan" NEXT x SYNC LOOP
Move it a little each frame, flip direction at the walls. This is the heart of almost every game.
SCREEN 320, 180 FASTGRAPHICS x = 40 y = 30 dx = 3 dy = 2 DO CLS x = x + dx y = y + dy IF x < 8 OR x > 312 THEN dx = -dx IF y < 8 OR y > 172 THEN dy = -dy CIRCLE (x, y), 8, "magenta" SYNC LOOP
Measure, upper-case and slice text. $ names hold words; MID$ pulls out one letter.
NAME$ = "basicFusion" PRINT "Length: "; LEN(NAME$) PRINT "Shout: "; UCASE$(NAME$) PRINT "First 5: "; LEFT$(NAME$, 5) PRINT "Backwards:" FOR i = LEN(NAME$) TO 1 STEP -1 PRINT MID$(NAME$, i, 1); NEXT i
A times table, a random dice roll with RND, and a square root. Great for homework helpers.
PRINT "7 times table:" FOR n = 1 TO 10 PRINT "7 x "; n; " = "; 7 * n NEXT n PRINT "Dice roll: "; INT(RND() * 6) + 1 PRINT "Root of 144: "; SQR(144)
A big head, two eyes, and a curved smile drawn dot by dot. Change the colours and make it yours.
SCREEN 200, 200 CIRCLE (100, 100), 80, "yellow" CIRCLE (72, 80), 9, "white" CIRCLE (128, 80), 9, "white" FOR a = 20 TO 160 x = 100 + COS(a * PI / 180) * 50 y = 115 + SIN(a * PI / 180) * 40 PSET (x, y), "red" NEXT a
| PRINT "text" | Write text or a number to the screen. |
| NAME = 5 | Store a number in a variable. |
| NAME$ = "hi" | Store text - the name ends with $. |
| SCREEN w, h | Switch to a pixel canvas of that size. |
| CLS | Clear the screen. |
| PSET (x, y), "col" | Light up a single pixel. |
| CIRCLE (x, y), r, "col" | Draw a circle at (x, y) with radius r. |
| FOR i = 1 TO 10 ... NEXT i | Repeat lines, counting from 1 to 10. |
| IF cond THEN ... | Run something only when the condition is true. |