#100DaysOfCode in Python Transcripts
Chapter: Days 13-15: Text-based games (and classes)
Lecture: Introduction to the chapter
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Michael Kennedy here and I'm going to be your guide
0:02
for the next three days.
0:04
We're going to have a lot of fun working
0:06
with classes and objects.
0:09
This is one of the fundamental ways to model
0:13
things, concepts in your application.
0:15
And you'll see that classes very naturally map to
0:19
sort of real world ideas and more general stuff,
0:23
that gets more specialized like, say,
0:25
a car versus a Ferrari.
0:27
Right, a car is this general idea.
0:29
A Ferrari also is a car but a more specialized type of car.
0:33
And we're going to actually build some really fun games.
0:36
We'll build one in the demo and then I'll hand off
0:38
a separate game for you to build.
0:40
So we're going to build this little
0:42
Dungeons and Dragons wizard game.
0:45
It comes in just says, "Hello, it's the wizard game."
0:47
And we have this wizard, Gandalf.
0:49
And he will encounter various creatures in his little world.
0:54
And he has three options:
0:55
he can attack, or run away, or look around.
0:58
And so you can see we're entering various commands.
1:00
R, A and L.
1:02
So, first we run away and then the wizard sees a bat.
1:05
It's not very strong so he thinks
1:06
he can attack the bat and win. He does.
1:08
And was very, very close actually.
1:10
They basically hide but he had the element of surprise,
1:13
so he beat the bat.
1:14
And then he can look around and see what else is there.
1:18
The toad, the tiger; not so scary.
1:20
Level 1000 evil wizard then he's probably
1:24
getting away from that thing.
1:25
Alright, so, this is what we're going to build and we're
1:27
going to build it by modeling these ideas
1:30
in this little game using classes.