Mining Simulator Section-1
DJWang (1358)

Hello everyone! I'm trying to start a small series on a Mining Simulator game. Throughout the series, we will design a game of Mining Simulator where you can mine blocks, sell them, and use the money to buy better equipment. Backpacks give you more storage and Tools help you mine faster.

Section-1 of Mining Simulator will teach you how to create the main structure of the game: Inside the mine. We will use hardcoded variables for our backpack and tool.

Let's get started!

Import the packs

Import the files/packs using this code.

from termcolor import cprint
from replit import clear
from time import sleep
  • cprint imports the text for colors.
  • Clear imports the function of deleting text
  • sleep imports the time in between print statements.

Your code should look like this:


To play this game, we need variables for our tools and backpacks. For our tools, we can make a variable called "ToolSpeed" so we know the time interval between mining blocks (We will measure ToolSpeed in seconds). For our backpack, we can have a variable called "PackLimit" to know our limit for the number of blocks we mine. Here is the code:

What this code really means is that every time you mine a block, it takes 3 seconds to be able to mine again, and once you've reached 10 blocks, you have to sell them.

Changing the Variables

Time to change the variables! Every time you mine a block, the tool needs a cooldown. The cooldown is the variable "Toolspeed." To mine a block, the output will need to be something that looks like this:

Press enter to mine a block. [0/10]

Then when you mine a block, it will say:

Regenerating... (Stay this text for three seconds)

Then it will clear the screen.

Then it will say:

Press enter to mine a block. [1/10]

You see the 0 changed to a 1. We can write the code as:

for i in range(PackLimit+1):
  print('Press enter to mine a block','[',(i),'/',PackLimit,']')
  input(">>> ")

So far, you should see this in your screen:

Closing the Mine- Last chapter of this section

When you've mined to your backpack limit, it should say a screen that says, "You've reached your backpack limit! Visit the store to buy a better backpack or sell your mined blocks!"

We already have a "for" loop to take care of the backpack limit, so we don't need an if statement. We simply write a line of code on the next line:

print("You've reached your backpack limit! Visit the store to buy a better backpack or sell your mined blocks!")


Thank you for taking the time to read this! Please upvote and I hope you have fun making this game! Remember: Criticism IS ALLOWED. Please tell me if there is anything wrong.

Remember to upvote if you like this!

Peace for now!

-DJStudios Team

You are viewing a single comment. View All