Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Set Up the Players

00:00 Let’s tackle this challenge. I’ve copy/pasted the instructions in here and formatted them just a bit so that they’re easier to read and that I can get started tackling one piece of this task at a time. Yeah, I want to play this game, but first I’ve got to write it, right?

00:14 So let’s do a little introduction. Start off with hello, welcome to this game. I’m going to print out,

00:22 "Welcome to the role-playing game!" Okay. It’s always nice to welcome your users, right? Just giving me a quick win, and then let’s start tackling this task.

00:35 The first one is that the game involves one player and one monster. I’m going to move this over here and create these two kind of like player instances. One is the computer, and the other one is the actual player.

00:49 What do we know about them? We know that the player begins with 100 health, while the monster starts with 150. We really just need the health of these two.

00:59 We don’t really need anything else about them in this small version of the game. So I’ll go ahead and say

01:08 player = 100 and monster = 150 And maybe let’s be a bit more descriptive, and because we’re going to be working with their health, so I’m going to call this player_health and monster_health. So, we have two variables, one for the player, one for the monster, and their respective health.

01:30 Let’s clean up a bit to keep this better readable.

01:35 Okay, so we tackled a couple of small tasks. Now the next one is going to start going into how do you deal with user input? Let’s look at in the next lesson.

Become a Member to join the conversation.