Update 2 – Bomb Allocation and Levels

This week I implemented the bomb allocation and level creation. Before I started allocating bombs, I had to come up with a system to generate the levels. I decided that I would do this by seeding the random generation so that every user would get the same levels. So, I set up my levels by using a big dictionary with the level number and then a list of ints that contain all the level info. In this list is the grid radius, the number of bombs, the number of bombs to show to the user and then each random seed for each bomb.

To receive the correct levels, I just get the level data from the levels dictionary. Once I have the level data, I then setup the grid using this data. In the process of setting up the grid, I need to spawn in the bombs. To decide where the bombs are located, I randomly select a number between 0 and the amount of grid tiles. This number is randomly generated based on the seed that is provided in the level info. Once the bombs have been selected, I check how many bombs I need to show and then show these bombs to the user.

This is a gif of bombs being generated: https://gyazo.com/da199905e91032ed30aeb42090d2f926

Here is a screenshot of a grid with bombs in it:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s