lundi 28 septembre 2020

Pygame, how do I get a random output to repeat the same value twice?

I'm coding a game and I want to have damage that is random per say. Lets say I did this for the first half of the code enemy_hp == enemy_hp - random.choice(damage) And damage = [1, 2, 3, 4, 5] When I run the code, it outputs a value 4, I want to get the same value a second time to print it on the screen for the player to see how much damage they dealt.

What would the second half of the code be? I've been stuck on this for a few hours now.

I don't know how confusing this is to read, so I'm going to give a 'quick' summary. I want to get the same value twice from a list using random.choice(). The second time I get that value it will be used in a line of code similar to this: print('random text here' + str(value))




Aucun commentaire:

Enregistrer un commentaire