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

Python Object-Oriented Python (retired) Hack-n-Slash Last Steps For Character

Julia Gron
Julia Gron
3,170 Points

how could self.hit_points ever be less than base_hit_points?

I'm a bit confused about the logic here.

in def init, we set self.hit_points = self.base_hit_points

but then in def rest, we had the condition: ''' if self.hit_points < base_hit_points: self.hit_points +=1

'''

how could self.hit_points ever be less than base_hit_points if they are set to be equal?

1 Answer

I believe later on you will write methods that subtract (damage) the player's hit_points when attacked. Then since the player's hit_points are lower than the maximum base_hit_points, the player can rest up and heal away any previous damage.

Hope this helps!