A package which can implement and draw the diamond-square in pgzero.
Project description
Diamond Square
Implementation of the Diamond Square Algorithm. This package can draw terrain on pgzero and pygame, also can set up interactive mode.
Interactive mode is only supported by pgzero. If you are using this package in pygame, you cannot use the interactive mode, but you can use the terrain generation.
Visit Diamond Square Description for a more detailed explanation of what this package can do.
Sample Generations:
Usage:
Drawing Terrain:
Use terrain = generate_terrain(roughness=..., biome=..., scale=..., size=...) to generate terrain. Once you generate terrain and store it in a variable, the terrain won't draw unless you call terrain.draw(screen).
When you pass in the screen parameter for terrain.draw(screen), this is expecting the pgzero screen or the pygame display surface. For pgzero, just enter screen for the screen parameter. This will have a yellow underline under it, but do not worry because this is what is supposed to happen.
Drawing interactive Terrain:
Use terrain = generate_interactive_mode(size=..., start_biome=..., max_roughness=..., scale=..., start_roughness=...) to generate an interactive scence which the user can interact and change the biome and roughness. Once you generate the interactive terrain and store it in a variable, the terrain won't draw unless you call terrain.for_draw(screen) in the draw function, terrain.for_on_mouse_down(pos) in the on_mouse_down function, terrain.for_on_mouse_up() in the on_mouse_up function, and terrain.for_on_mouse_move(pos) in the on_mouse_move function.
If you leave out any one of these, then it will create unexpected results or fail. As of latest version, drawing interactive terrains is not suppored by pygame. You can only use this in pgzero.
For the draw function, when you pass in the screen parameter for terrain.draw(screen), this is expecting the pgzero screen or the pygame display surface. For pgzero, just enter screen for the screen parameter. This will have a yellow underline under it, but do not worry because this is what is supposed to happen.
Versions:
Version 0.0.1: Main code for diamond-square added.
Version 0.0.2: Updated REAMDE file and added documentation.
Version 0.0.3: Fixed bugs and errors
Version 0.0.4: Added sample terrain.
Version 0.0.5: Added sample terrains.
(Latest) Version 0.0.6: Added a function to add/remove biomes and external website for more detailed documentation.
Coming Soon:
Version 0.0.7: Added parameter pos to determine where to place the terrain and add function to save the terrain as an image.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file diamond_square-0.0.6.tar.gz.
File metadata
- Download URL: diamond_square-0.0.6.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
528f5fab4ab6132bc77ece1530ead75056467dd793a155ec150addf15b977e74
|
|
| MD5 |
1b80a13ca0aaede9b3ce61e36fd4e630
|
|
| BLAKE2b-256 |
b5989909a3714ba4cd4d8803ce0af22efc6eaa2c5dec9a5f1fb9c2bea332d539
|
File details
Details for the file diamond_square-0.0.6-py3-none-any.whl.
File metadata
- Download URL: diamond_square-0.0.6-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fcb1bdac222f0eb224dc8d14247ad68f59cd9bdc80e1653eed8bdd77460bf5ca
|
|
| MD5 |
19c9e3166ab113f4ab21ba8e3a9a760d
|
|
| BLAKE2b-256 |
1f4a1141169c1625f1c595f7a61aaec67c0fda5e33108fe218cfd354b3db629c
|