Share your repls and programming experiences

← Back to all posts
Monster battle
coderbob (3)

This is a game I made where you fight a monster in a battle

Commentshotnewtop
coderbob (3)

Sorry if it is a bad game.
I am new to repl

Foster_Bryant (3)

For cleaner code:
replace line 11 to 18 with the code I wrote in here https://repl.it/@Foster_Bryant/nothing

Foster_Bryant (3)

@Foster_Bryant it uses \n so you can write it all i na single line and a single print statement

IreoluwaRaufu (1)

I think this is a good game you have here, let me make a few suggestions on what you can add:

  1. Make the damage dealt and healed a bit more random (You can set a range of
    integers to be randomly generated using import random)
  2. The player's health and the monster's health need to have a cap. Once they reach 100
    or so, healing shouldn't add to their total health
  3. Add some flair. There's a lot more you can do here, giving boosters on random rounds
    that increase damage for a few turns or having a random chance of the monster
    respawning as a surprise twist at the end, if the player wins

Overall great game, if you have extra time on your hands, try to improve on this!

coderbob (3)

@IreoluwaRaufu I don't really know how
I am new

IreoluwaRaufu (1)

@coderbob Considering you're new, you've done pretty good. Here's some sample code for making the damage and heal amounts random:

import random
damageAmount = random.randint(8, 20)
healAmount = random.randint(10, 15)

-The randint() function will generate a random integer between two numbers you specify, including the lowest and highest numbers, so random.randint(10, 15) will really generate a random number between 10 and 15.

-This will allow you to make things a bit more interesting in the game, but remember to redefine the heal and damage amounts every round, or it'll be the same every time once it's defined.
Make of this what you will and have fun!

coderbob (3)

best game on python

IreoluwaRaufu (1)

@Legend01 Hey now, let's not be mean about it, he said he was an amateur...

Legend01 (2)

@IreoluwaRaufu yes... It's true but this is very basic, like he COULD have do a bit more i think... Like a bit more of strategy, not just attacking and then healing.