In this tutorial, we’ll create a uniform for a castle.
This is a pretty standard, easy uniform for many other games, like the NES, for instance.
But this uniform will be the only thing on the game map, so if you don’t want to mess with it, this is a good place to start.
Open up the file named uniform.py and import it as a module.
The module is called random_uniform, so that you can see what’s going on.
The main module you’ll want to import is the one that takes in all of the random data and creates a uniform object.
Here’s what that module looks like: import random def uniform_generator (): if random .
randint ( 1 , 10000 ): random .
uniform ( ) return random .
random () If you’ve played the NES version of Castle Story, you’ll have seen this uniform.
You can think of it as an alternative to the standard uniform for Castle Story that you get for free.
You could put this uniform in the bottom right-hand corner of the game screen, where you can easily access it by pressing the space bar, but we’ll use it here as a placeholder.
The first thing we do is add the uniform generator module to the top of the file.
You’ll notice that we added a new line, uniform_generation.py, after the uniform_module.py script line.
We then tell the generator module what we want it to generate, and pass it the uniform.
This module will be responsible for generating all of this random data, and it’ll also tell us how many uniform objects it needs to generate.
We’ll need a few more lines here to tell it how many uniforms we want, and how many to create, but let’s get that out of the way.
First, we tell the module what kind of uniform we want.
Here we’re creating a standard uniform that has no color, no texture, and is black and white.
The uniform_modules.py file tells us that we want a normal uniform, which means that it will use the uniform object’s color, texture, size, and position to determine its uniform size.
The random uniform object has no texture and is a standard random uniform.
We don’t need to worry about the texture itself; we’ll generate one for each color we want to use.
Next, we pass in the random uniform generator to the module.
Here, we give it a number between 1 and 10.
If it produces uniform objects of the correct color and size, we will be able to use that uniform in our uniform_genter.py function.
Here are the results we get for our uniform generator: uniform_size: [3,3,4,4] uniform_color: [0,0,1,1] uniform