SMILE 2.0Learn & build
Language guide

Keep making games

Debug & build what is next

Read the clues, fix one thing at a time, and turn your first game into the next idea you want to play.

When it breaks, become a detective

A bug is a clue about a difference between what you meant and what you wrote. First decide which kind of problem you have: does the program fail to build, close while running, or run with the wrong behavior?

1. Make it repeatable

Describe the shortest steps that cause it: “Start the game, hold Right, then touch a star.” Save your work before experimenting.

2. Find the first wrong fact

Check the relevant input, position, score, or state flag. The wrong picture may simply be showing an earlier mistake.

3. Change one thing

Make the smallest correction, rebuild, and repeat exactly the same steps. Then check that the surrounding behavior still works.

Read a compiler message

The compiler points to a file, line, and column, followed by an error code and explanation. Fix the first useful error first; later messages can be side effects of the same missing word.

star-collector.smile(3,1): error SML3303:
Variable 'Scoree' must be declared because Option Explicit is enabled for this source.

This is the message from a tiny example containing a misspelled variable on line 3. Your file's line and column will be different. Here, Scoree is probably meant to be Score.

ClueLikely causeWhat to check
SML3303A name is undeclared under Option Explicit.Compare its spelling with the Dim declaration. Declare it only if you really need a new variable.
SML3304A value has the wrong type.Score = "ten" tries to store Text in a Number. Use a number for arithmetic and a separate Text value for words.
SML2001An expected word or block ending is missing.Check the indicated line and the block immediately above it. Every If needs End If; a Sub needs End Sub.
SML3308A text operation mixes incompatible types or uses an unsupported operator.Keep numbers numeric. In a game HUD, use Draw Text for the label and Draw Number for the score.
SML3021A function or routine name is unknown.Check its spelling. For a library call, confirm the package/source reference and the matching Import alias.

The typo, Text-to-Number, and missing-End If examples were checked against the available native SMILE compiler when this guide was written. The complete diagnostic reference lives in the official language documentation.

Try fixing a tiny broken program

This program intentionally contains two mistakes. It is a debugging exercise, not a working example.

Option Explicit

Dim Score As Number

Scoree = 3
Score = "four"
Print Score

First change Scoree to Score. Then change "four" to 4. The final printed value is 4 because the second assignment replaces the first.

It runs, but something feels wrong

What you seeWhere to investigateSmall experiment
The player leaves a trail.Drawing order.Check that Clear runs before drawing every frame.
The game shows an empty window.The main loop and presentation.Draw one bright rectangle at a known position, then call Show Screen.
Movement happens only when a key repeats.Input.Use Key_Held for continuous movement. Keep Get Key for actions such as menu choices.
The player speeds up on another computer.Timing.Use elapsed time rather than adding the same distance on every frame.
The player partly leaves the arena.Boundary math.The largest X is the right wall minus the player's width.
Stars count from far away.The hitbox test.Check that horizontal and vertical overlap are joined with And.
A new round keeps the old score.Reset state.Confirm ResetGame assigns Score = 0 and is actually called.

In a graphics game, put temporary values on screen just before the main loop's Show Screen:

Draw Text "Player X" At 32, 110 Size 18 Color WHITE
Draw Number PlayerX At 130, 110 Size 18 Color YELLOW

In a console example, Print Score is a quick way to inspect a value. Remove temporary displays once they have answered your question. If Visual Studio debugging is configured, set a breakpoint near the suspected update and inspect its values there.

Draw the invisible rules

In DrawGame, temporarily add Draw Rectangle StarX, StarY, StarSize, StarSize, MAGENTA. You can now see the exact hitbox used by the collision test.

Choose your next game

Reuse one idea from Star Collector and add one new idea. Finish a small playable version before adding effects, menus, or more levels.

Build nextWhat you already knowOne new idea to studyOfficial example
Catch the falling starsHeld keys, overlap, score, and restart.Make the star's Y position increase over time. Reset it above the arena when caught or missed.Remix Star Collector.
Paddle BallMovement, timing, boundary limits.A moving ball has velocity. A bounce changes the relevant velocity's sign.Paddle Ball teaching source.
SnakeFood placement, collection, score.Store a trail of grid cells, grow it, and prevent the head from hitting the body.Snake project and model.
Brick BreakerBall movement and rectangle tests.Use an array to remember which bricks remain.Brick Breaker teaching source.
Maze MuncherGrid movement, collecting, game states.Parse a tile map and choose legal moves for enemies.Maze Muncher project.
Use each example as a complete project

The official games may need additional source files, maps, sounds, and project settings. Copy or open their whole project, then read its README. A Program-NoDemo.smile file keeps the playable game while removing its automatic attract demo; select it as the project's StartupFile. Snake also needs SnakeModel.smile.

Grow your toolkit when the game needs it

More things on screen

Learn loops and arrays to update a row of bricks or a list of pickups without copying the same code again and again.

Maps, cameras, and battles

Explore the library guide for Smile.Game, Smile.RPG, and the other source packages.

An ambitious 3D path

Study Arena and elemental effects to see how an arena and reusable Fire, Water, and Earth effects fit into a larger native SMILE program.

Those larger projects still repeat the same story: get input, update state, draw, and present. Bigger art does not replace those foundations.

A small finished game is a real achievement

Before calling your game finished, ask someone else to play it without instructions from you. Watch where they get confused, then improve the on-screen instructions or feedback.

  • Can a new player understand the goal and controls?
  • Can the game start, finish, and restart cleanly?
  • Do the score and on-screen messages agree with the game rules?
  • Can the window close normally?
  • Does the complete project work from another folder with its required assets?

Keep a working copy before your next experiment. Add one feature, test it, and keep going.

Sources & version notes

Checked against the local SMILE 2.0 source on September 25, 2026. Examples target the native Windows toolchain unless stated otherwise. The linked repository may continue to evolve.