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.

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.2, 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.

(Latest) Version 0.0.4: Fixed bugs and errors

Version 0.0.4: 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.3.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.3-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: diamond_square-0.0.3.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.3.tar.gz
Algorithm Hash digest
SHA256 701d2678793071347ee030e6f1d30cfabee90a874c8ffb0a6152f3c1a24b7a65
MD5 8d21e7b91d3434fc8b4c67532eec352a
BLAKE2b-256 9c18ae6c6b57f8148cb4a584430ffe04fc766a31740312fc1d9d02a04eb44985

See more details on using hashes here.

File details

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

File metadata

  • Download URL: diamond_square-0.0.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 59c2f92597882f5a3d006f0019d6d947efd4070139aa79bf265a22e52771df27
MD5 ff646e8ba63eddd98b7790f157e9414a
BLAKE2b-256 6ead4426020054ab70bba29821dc32f367e893933f177804cfeafd4d2ca11266

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