Skip to content

Art9681/Pymunk-Simple-Terrain-Demo

Repository files navigation

Requires Python, Pyglet, Cocos2D and noise libraries.

Run main.py to launch demo.

Controls:
- Move with A, D
- Jump with SPACE
- V disables tile layer and enables open gl drawing of pymunk physics objects. (SLOW!!)

Notes:
- Zooming out bugs out the physics.
- It takes a split second to generate the level! This is because it is all loaded into memory.
- Also lags a bit on quit.

Recent changes:
- Improved terrain gen at horizon. Hills now generated with 1D perlin noise. Good stuff!
- Solid blocks can be clicked on to remove. This behavior changes the solid block to an air block and regenerates the segment colliders on the fly. (AWESOME SAUCE!!)
- Added Pymunk 2D physics.
- Added algorithm to generate pymunk segment colliders around solid terrain blocks.

TODO:
- Add multiple passes to the terrain gen. One pass generates all the solid tiles, second pass generates cave system.
- Load/Unload tiles during runtime so that the world can potentially be infinite in size.
- Add developer menu.
- Limit zoom to prevent crash.
- Highlight tile on mouse hover.
- LEFT mouse click changes tile. RIGHT mouse click deletes tile.
- Add menu to select tiles or other items.
- Load level in chunks.

Older changes:
- Added back ground color layer.
- Map is now divided between ground and sky.
- Mouse scroll zooms in or out. Careful! Scrolling while you zoom out too much it will crash.
- Mouse click removes tile and triggers map redraw. (Pretty fast for the map size!)
- Moar caves!
- Added scrolling background layer.
- Added input. W, A, S, D keys scroll level.

Removed:
- Created function that interpolates column height to create rolling hills horizon. (Replaced by new noise function).
-Added basic collision model. Map blocks only have collision enabled on top segment for now. You can walk through the blocks but not fall through them.
- Mouse move returns position in world coordinates.
- Mouse click returns Cell texture id.

About

Procedural tile map generation with 2D physics.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages