Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
wylecordero
1,788 PointsFinal game on python object oriented, Can not get it to work
Error that I keep getting is: AttributeError: 'Game' object has no attribute 'player_hit_points'
wylecordero
1,788 PointsThe error is pointing to line 86
1 Answer
Jennifer Nordell
Treehouse TeacherHi there! You haven't included your Character class module so I can't be absolutely positive, but I feel like this is a typo. You've typed:
while self.player_hit_points and (self.monster or self.monsters):
I believe that should be:
while self.player.hit_points and (self.monster or self.monsters):
It seems that the player is an instance of the class Character and hit_points should be a stored property there. This means that we access it with dot notation.
Hope this helps!
wylecordero
1,788 PointsHello Jennifer,
You are correct, I kept over looking that. I also notice a lot of more typos with the monster variables. It is working now. Thanl you so much.
wylecordero
1,788 Pointswylecordero
1,788 Points