Start building now
Choose how you want to begin this project.
Open it privately for practice or create a shared workspace to build it together.
No setup required • Guided steps inside the editor
Private practice
Open a private editor and work through the steps at your own pace.
Start project aloneShared workspace
Create a live session so you can teach, pair, or build the project together.
What you'll build
A character class that tracks player stats and updates them based on events.
What you'll learn
- How to create and initialise a class
- How to use constructors (__init__)
- How to update attributes using methods
- How to design simple game logic with objects
How it works
A character has a name, money, experience, and position.
The constructor sets initial values.
Methods allow the character to move and gain rewards.
Different types of rewards affect different attributes.
Build path
These steps appear inside the editor so you can build one part at a time.
- 1
Step 1
Create the constructor
Initialise name, money (5), experience (0), and road position (0).
- 2
Step 2
Add getter methods
Create methods to return each attribute.
- 3
Step 3
Move the character
Create a method that adds a number of steps to the position.
- 4
Step 4
Update values method
If type is 'money', add value to money. If 'experience', add to experience.
- 5
Step 5
Ignore invalid types
If the type is not recognised, do nothing.
More to explore
Want a different challenge?
Browse more guided projects, or come back and start this one whenever you are ready.