C# Basics for Game Makers
Go from zero to real C# by making game stuff: health bars, loot, damage and bosses. Write a line, press Run and see what it does.
143 lessons, about 29 h 55 min
Guest mode. Chapter 1 is fully playable. Sign up to open the rest and keep your progress.
Your first program
14 lessons, about 2 h 14 min
Print text, see how statements run in order, read compiler errors, use comments and build a title screen.
- What is a programming language? Demo, +25 XP, 3 min
- The editor and the console Demo, +25 XP, 2 min
- Hello, World! Demo, +25 XP, 7 min
- Printing a line Challenge, +20 XP, 8 min
- Statements run in order Challenge, +20 XP, 8 min
- Write vs WriteLine Challenge, +20 XP, 10 min
- Predict the output Predict, +15 XP, 12 min
- Printing a text box Challenge, +20 XP, 9 min
- Fixing compiler errors Challenge, +20 XP, 9 min
- Comments Demo, +25 XP, 8 min
- Commenting out code Challenge, +20 XP, 10 min
- ASCII art Challenge, +20 XP, 10 min
- Quiz: printing and errors Quiz, +15 XP, 13 min
- Chapter project: Title screen Boss, +100 XP, 25 min
Variables and types
16 lessons, about 2 h 55 min
Store values in named variables: whole numbers, decimals, text, single characters and true or false. See how numbers are stored in bits and bytes, and how to pick int, uint or long.
- What a variable is Demo, +25 XP, 8 min
- Joining text and numbers Challenge, +20 XP, 9 min
- Declare now, assign later Demo, +25 XP, 8 min
- Predict the output: changing values Predict, +15 XP, 14 min
- Text in string variables Challenge, +20 XP, 9 min
- Decimals and booleans Challenge, +20 XP, 9 min
- char and float Challenge, +20 XP, 9 min
- Quiz: choosing a type Quiz, +15 XP, 13 min
- Bits and bytes Challenge, +20 XP, 11 min
- int, uint, long: picking a number type Challenge, +20 XP, 12 min
- Predict the output: number types Predict, +15 XP, 11 min
- Naming variables Challenge, +20 XP, 9 min
- Using var Challenge, +20 XP, 9 min
- Constants with const Challenge, +20 XP, 10 min
- Fixing type errors Challenge, +20 XP, 9 min
- Chapter project: Character sheet Boss, +100 XP, 25 min
Math and operators
17 lessons, about 3 h 14 min
Do math in C#: operators, order of operations, division and remainder, casting, rounding and the Math methods. Learn what happens when a number overflows, and when to use float, double or decimal.
- Math with variables Demo, +25 XP, 7 min
- Updating a variable Challenge, +20 XP, 9 min
- Shortcut operators Challenge, +20 XP, 11 min
- Parentheses in formulas Challenge, +20 XP, 10 min
- Quiz: order of operations Quiz, +15 XP, 13 min
- Predict the output: integer division Predict, +15 XP, 12 min
- Uses for the remainder Challenge, +20 XP, 10 min
- Integer and decimal math Demo, +25 XP, 10 min
- Casting a double to an int Challenge, +20 XP, 10 min
- Rounding numbers Challenge, +20 XP, 10 min
- Math.Min and Math.Max Challenge, +20 XP, 10 min
- Percentages Challenge, +20 XP, 10 min
- Distance between two points Challenge, +20 XP, 10 min
- Overflow and wraparound Challenge, +20 XP, 12 min
- Spot the bug: unsigned subtraction Challenge, +20 XP, 11 min
- float, double and decimal Challenge, +20 XP, 13 min
- Chapter project: Combat round Boss, +100 XP, 26 min
Strings
12 lessons, about 2 h 24 min. Pro chapter
Names, dialogue, damage popups, quest cards and scoreboards are all text. Build it, format it and line it up.
- String interpolation Demo, +25 XP, 10 min
- Expressions inside {} Challenge, +20 XP, 10 min
- Predict the output: escape sequences Predict, +15 XP, 12 min
- Escapes and verbatim strings Challenge, +20 XP, 9 min
- String methods and Length Demo, +25 XP, 11 min
- Length, ToUpper and Trim Challenge, +20 XP, 9 min
- Replace, Contains and StartsWith Challenge, +20 XP, 11 min
- IndexOf and Substring Challenge, +20 XP, 11 min
- Formatting numbers Challenge, +20 XP, 10 min
- Lining up columns Challenge, +20 XP, 11 min
- Quiz: strings Quiz, +15 XP, 14 min
- Chapter project: Quest card Boss, +100 XP, 26 min
Decisions
14 lessons, about 3 h 8 min. Pro chapter
Make your game react: if, else, switch, comparisons and true or false logic.
- Running code with if Demo, +25 XP, 11 min
- Predict the output: comparisons Predict, +15 XP, 15 min
- if and else Challenge, +20 XP, 10 min
- else if chains Demo, +25 XP, 13 min
- Ranks and boundary values Challenge, +20 XP, 12 min
- Spot the bug: the unreachable branch Challenge, +20 XP, 15 min
- Nested if statements Challenge, +20 XP, 13 min
- Logical operators Challenge, +20 XP, 12 min
- Under the hood: how the computer decides Challenge, +20 XP, 13 min
- switch statements Challenge, +20 XP, 12 min
- Switch expressions and the ternary operator Challenge, +20 XP, 11 min
- Comparing strings Challenge, +20 XP, 10 min
- Quiz: reading conditions Quiz, +15 XP, 13 min
- Chapter project: Shop checkout Boss, +100 XP, 28 min
Loops
14 lessons, about 2 h 59 min. Pro chapter
Repeat work without repeating code: while, for, break and continue, waves and timers.
- while loops Demo, +25 XP, 11 min
- for loops Challenge, +20 XP, 11 min
- Predict the output: loop counts Predict, +15 XP, 16 min
- Using the loop counter Challenge, +20 XP, 10 min
- Loop variables and scope Demo, +25 XP, 12 min
- Running totals Challenge, +20 XP, 11 min
- Building a line with a loop Challenge, +20 XP, 11 min
- break and continue Challenge, +20 XP, 12 min
- do-while loops Challenge, +20 XP, 11 min
- Nested loops Challenge, +20 XP, 12 min
- Under the hood: counting steps Challenge, +20 XP, 11 min
- Spot the bug: the extra wave Challenge, +20 XP, 11 min
- Quiz: loops Quiz, +15 XP, 13 min
- Chapter project: Wave defense Boss, +100 XP, 27 min
Methods
14 lessons, about 3 h 4 min. Pro chapter
Package code into named actions you can reuse: parameters, return values and scope.
- Writing and calling a method Demo, +25 XP, 12 min
- Parameters and arguments Challenge, +20 XP, 10 min
- Return values Challenge, +20 XP, 12 min
- Math methods and overloads Demo, +25 XP, 12 min
- Methods that return bool Challenge, +20 XP, 11 min
- Predict the output: scope Predict, +15 XP, 14 min
- Predict the output: parameters are copies Predict, +15 XP, 14 min
- Default values and named arguments Challenge, +20 XP, 11 min
- Methods that call methods Challenge, +20 XP, 12 min
- Passing a Random into a method Challenge, +20 XP, 12 min
- Under the hood: the call stack Challenge, +20 XP, 13 min
- Spot the bug: the heal that does nothing Challenge, +20 XP, 10 min
- Quiz: methods Quiz, +15 XP, 14 min
- Chapter project: Combat calculator Boss, +100 XP, 27 min
Collections
14 lessons, about 3 h 3 min. Pro chapter
Hold many things at once: arrays, List and Dictionary for inventories, waves and lookups.
- Arrays Demo, +25 XP, 11 min
- Predict the output: array indexes Predict, +15 XP, 14 min
- Looping over an array Challenge, +20 XP, 12 min
- Finding the largest value Challenge, +20 XP, 11 min
- Lists Challenge, +20 XP, 11 min
- Removing and finding items Challenge, +20 XP, 12 min
- Spot the bug: removing while looping Challenge, +20 XP, 11 min
- Dictionaries Demo, +25 XP, 12 min
- Dictionary lookups Challenge, +20 XP, 12 min
- Under the hood: memory and lookup speed Challenge, +20 XP, 15 min
- Split and Join Challenge, +20 XP, 12 min
- Sorting Challenge, +20 XP, 10 min
- Quiz: collections Quiz, +15 XP, 13 min
- Chapter project: Inventory manager Boss, +100 XP, 27 min
Classes and objects
14 lessons, about 3 h 23 min. Pro chapter
Build your own types: fields, properties, constructors and methods for heroes and enemies.
- Defining a class Demo, +25 XP, 11 min
- Making several objects Challenge, +20 XP, 10 min
- Methods on objects Challenge, +20 XP, 11 min
- Constructors Challenge, +20 XP, 12 min
- Properties Demo, +25 XP, 13 min
- Encapsulation Challenge, +20 XP, 13 min
- Under the hood: references and null Challenge, +20 XP, 17 min
- Predict the output: objects Predict, +15 XP, 16 min
- Lists of objects Challenge, +20 XP, 16 min
- Spot the bug: every goblin took the hit Challenge, +20 XP, 13 min
- Static and instance Challenge, +20 XP, 12 min
- Printing objects with ToString Challenge, +20 XP, 15 min
- Quiz: classes and objects Quiz, +15 XP, 15 min
- Chapter project: Hero class Boss, +100 XP, 29 min
Inheritance and interfaces
14 lessons, about 3 h 31 min. Pro chapter
Share and swap behavior: enums, structs, inheritance and interfaces.
- Enums Demo, +25 XP, 12 min
- Switching on an enum Challenge, +20 XP, 13 min
- Predict the output: structs and classes Predict, +15 XP, 15 min
- Inheritance Demo, +25 XP, 13 min
- Derived classes and base Challenge, +20 XP, 13 min
- virtual and override Challenge, +20 XP, 14 min
- Under the hood: how the right method gets called Challenge, +20 XP, 15 min
- Spot the bug: the dragon that attacks like a goblin Challenge, +20 XP, 13 min
- Abstract classes Challenge, +20 XP, 11 min
- Interfaces Challenge, +20 XP, 13 min
- is, as and pattern matching Challenge, +20 XP, 16 min
- Quiz: inheritance or interface Quiz, +15 XP, 15 min
- Ready for Unity Challenge, +20 XP, 15 min
- Final project: Dungeon run Boss, +100 XP, 33 min