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 alone

Shared 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

1

A character has a name, money, experience, and position.

2

The constructor sets initial values.

3

Methods allow the character to move and gain rewards.

4

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. 1

    Step 1

    Create the constructor

    Initialise name, money (5), experience (0), and road position (0).

    Complete in the editorHint available
  2. 2

    Step 2

    Add getter methods

    Create methods to return each attribute.

    Complete in the editorHint available
  3. 3

    Step 3

    Move the character

    Create a method that adds a number of steps to the position.

    Complete in the editorHint available
  4. 4

    Step 4

    Update values method

    If type is 'money', add value to money. If 'experience', add to experience.

    Complete in the editorHint available
  5. 5

    Step 5

    Ignore invalid types

    If the type is not recognised, do nothing.

    Complete in the editorHint available

More to explore

Browse more guided projects, or come back and start this one whenever you are ready.