How to Learn Game Coding (For Kids)
My friend’s son, who is in elementary school, recently sent me a list of questions about game programming.
I’m posting my answers here because I know that it’s a popular topic for young people.
Q: How do you make a game from scratch?
There are a lot of ways to make a game nowadays, but I would recommend PICO-8. It has everything you need to make small, fun games using code.
By using it, you’ll learn about the different parts that make up a game.
For example, “sprites” are the images you use for things like spaceships, characters, and explosions. You can program sprites to move around and animate when you press a button.
You will also learn how “collisions” work, like making a ship explode when a bullet runs into it.
Once you learn those things, you can try making bigger games using more advanced languages, or just keep getting better at making cool PICO-8 games.
Also, while you make a game, you can learn a lot of other fun skills aside from coding — like art, storytelling, music, sound effects, and interaction design (making a program easy to use).
You might even find out that you those things better than coding!
Q: How do you learn to code?
I believe the best way to learn to code is:
1) Pick a language that is easy for beginners (like PICO-8 or Python), and
2) Make a small program or game that interests you.
Programming takes a lot of trial and error. Bit by bit, you add new lines of code to your program.
It’s like a snowball that gets bigger as it rolls down a hill. You start with a tiny program and add more as you go.
This takes a lot of patience, because you’ll spend a lot of time fixing mistakes (also known as “bugs”).
That’s why it’s important to work on a project that you like! If you just learn coding by reading a book, you might get bored and give up more quickly.
It’s also important to pick a project that is small. A lot of people try to make games that are too big, so they spend a lot of time and never finish them.
Even a small game can take many days or weeks to finish, but it will teach you a lot. And sometimes a small game can be a ton of fun (Tetris is a great example).
Q: Why did you start coding?
I started learning the BASIC programming language when I was about 7.
Like most kids, I learned it because I wanted to make games. When I got older, I became interested in making cool web sites and that’s where I learned more advanced programming.
I still like to program because it lets me be creative and I can make things that other people can use.
Q: What kind of code do you like the best?
I try to write code in a way that is easy for me to understand when I come back to it later. Sometimes it’s not easy to figure out what code does, even if I wrote it myself!
Writing code is kind of like writing in English. You want to write it in a way that is easy to read and understand.
There is no one programming language that is the best. I use the languages that let me build the ideas that I have.
I even created my own programming language called THT so that I could use it to make websites more quickly.