Skip to main content

A package which can implement and draw the diamond-square in pgzero.

Project description

diamond_square

Implementation of the diamond-square. Can draw terrain on pgzero and pygame. Also can set up interactive mode.

Sample Default Terrain

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 version 0.0.4, 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

(Latest) Version 0.0.4: Added sample terrain.

Version 0.0.5: Added a function to add/remove biomes and added parameter pos to determine where to place the terrain.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

diamond_square-0.0.4.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

diamond_square-0.0.4-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file diamond_square-0.0.4.tar.gz.

File metadata

  • Download URL: diamond_square-0.0.4.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for diamond_square-0.0.4.tar.gz
Algorithm Hash digest
SHA256 28bbbaf69a238a23f5cb6e8a7b4dc1a977465174f8123130978e70c2a658c640
MD5 2d6df07ddd504f0e9e27b3b869f3dba8
BLAKE2b-256 1bf2e77baf38fa930f3bccae07d052c61777171c68abbea3bef5559121f70f60

See more details on using hashes here.

File details

Details for the file diamond_square-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: diamond_square-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for diamond_square-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c59a39b5d22538757727192abddcf0eed43a8e3d657dff39ac2d151c5e52e97c
MD5 e99684b3d1b1498ba3ffe762b3e2b5fb
BLAKE2b-256 ce0ccfe396dbc8c6d0b54d088d28eb458e94c9e790ec25978dea39d6ee1b472a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page