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.

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. (Latest) Version 0.0.2: Updated REAMDE file and added documentation. Version 0.0.3: 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.2.tar.gz (4.8 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.2-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: diamond_square-0.0.2.tar.gz
  • Upload date:
  • Size: 4.8 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.2.tar.gz
Algorithm Hash digest
SHA256 723733769dfc6de99e2eb58fbf2aa9ac30e876437e568d58860c2b68c15e820c
MD5 c8f7a9ca486af84b63ebb5c422de85d5
BLAKE2b-256 b6c0a24a2b423b93a0ec941fed7305eec1188bcad2b5fac68d733276b7641da4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: diamond_square-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.8 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4336c9d79bd0cb83257af105fa3724cfbd78cf4185f3854ec6d9158e41a0571a
MD5 e85d366a2b1d260eb11337b6cd6bb80b
BLAKE2b-256 439727a958ce4d375809f65d9a8b5c813d57a47d2d5d1357d81f912775263f94

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