Computers have their own language called source code. People use source code to tell computers what to do.
In Code Combat, you’ll play a game where you explore, learn, and practice writing code. You’ll be using a language called Python. Python looks like regular words, so it’s easier to read and write.
Here are some important commands you’ll use:
Methods → Actions your hero can do (move, attack). Example:
hero.moveRight() makes your hero move right.
Arguments → Extra details for methods. Example:
hero.moveRight(4) moves 4 steps.
Strings → Words in quotes. Example:
hero.attack("Treg") tells your hero to attack Treg.
Variables → Shortcuts that can change. Example:
hero.findNearestEnemy() attacks the closest enemy instead of naming each one.
Loops → Repeat steps over and over. Example:
A loop can make your hero move through a maze without retyping each move.
In this Challenge, you’ll program your hero to avoid traps and defeat enemies.