Build a Player Profile

STEP 4 — Build a Player Profile (Your First Real Game System)

Alright young developer, this is it — the moment where your random little variables stop floating around like lost balloons and finally come together to form something REAL.

You’re about to build a player profile — the foundation of every game ever made.

Think of it like creating your character in a video game, except this time you are the one writing the code. Yes, you. The same person who once forgot where they put their phone while holding it.

What’s a Player Profile?

It’s a collection of variables that describe your character:

  • name
  • health
  • coins
  • XP
  • speed
  • alive or not

It’s basically your character’s ID card, but cooler and with more danger.

Every game has one — Minecraft, Fortnite, Pokémon, even that weird mobile game you downloaded at 2 AM.

Why This Matters

Once you have a player profile, your game can:

  • track progress
  • update stats
  • react to events
  • save data later
  • make the player feel like they exist

Without a profile, your game is like:

“Who are you? What’s your name? Why are you here? Why do you have a sword?”

We don’t want that.


Code Example — Your First Player Profile

player_name = "Nova"
health = 100
coins = 50
xp = 0
speed = 3.5
is_alive = True

print("Player Profile:")
print("Name:", player_name)
print("Health:", health)
print("Coins:", coins)
print("XP:", xp)
print("Speed:", speed)
print("Alive:", is_alive)
print(wizard_name, mana, health, spell_power, has_staff)
Try yourself.

Boom.
You just built the backbone of a real game character.


Level Up — Updating the Profile

Let’s make the character actually do something.

# player takes damage
health = health - 30

# player finds treasure
coins = coins + 20

# player gains XP
xp = xp + 100

print("Updated Profile:", health, coins, xp)

Your character is now living their best (and slightly dangerous) life.

Try yourself.

Practice (Your Turn!)

Mini Challenge — (With Answer)

Challenge:

Create a player profile for a wizard.

Include:

  • name
  • mana
  • health
  • spell_power
  • has_staff

Then update:

  • mana decreases by 25
  • health increases by 10
  • spell_power increases by 5
Modify and Run