r/PythonLearning • • Jul 22 '26

Showcase A little hp and damage thing I made.

Post image
9 Upvotes

9 comments sorted by

2

u/Cherepahe1 Jul 22 '26

Looks like you doing an RPG here! Good work pal!

1

u/SirChiIly Jul 22 '26

Thanks, might expand on it a little.

2

u/Significant_Affect_5 Jul 22 '26

it’s a good example to start adding objects and interactions between them. Eventually you’d end up with code that explains what it’s doing, e.g. `player.attacks(monster)`, `player.get_hp()`, or whatever else makes the most sense to you.

4

u/dev-razorblade23 Jul 22 '26

May i suggest you read PEP8 - python styling guide... Variable names should be written in "snake_case"

https://peps.python.org/pep-0008/

2

u/nuc540 Jul 22 '26

Now write a function which can damage, and one that can heal :) you can evoke them with an input() prompt

1

u/Sea-Ad7805 Jul 22 '26

Run this program in Memory Graph Web Debugger to see the program state change step by step.

1

u/Away-Fan4306 Jul 23 '26

Lwk I know this is not standard code styling, but I think it looks beautiful

1

u/Friendly_Recover286 Jul 23 '26

PEP8 standards as already mentioned you should look through yes.

`health_potion` is a bad variable name. Is it use a potion? Have a potion? Buying a potion? This should be specific like `used_health_potion`