Slopy Platforming - 0.1
A scrolling platformer that handles sloped surfaces. A learning exercise that I will try to build upon to turn into a real game.
Sean J McKiernan
This is a simple scrolling platformer that allows the player to move on sloped surfaces. It is a work in progress and the collision detection is currently a bit over-complicated.
I hope to simplify the logic and expand it to allow other standard platforming elements like moving platforms. I also need to generalize it to work with screen dimensions and tile sets of varying sizes.
The repo contains both the working program and a simple map editor, run with main.py and map_editor.py respectively. Simply download the repo as a zip or clone the repository.
- Left and right to move.
- Spacebar to jump (release early to cut jump short)
- Map Editor:
- Left mouse button to select and place tiles.
- Right mouse button to delete tiles.
- Arrow keys to pan map.
- CTRL+S and CTRL+L to save and load.
Code still needs to be simplified. Speed while on slopes needs to decrease proportionately. Code needs to be generalized (magic numbers removed).
The game should run with python 2.x and 3.x. The map editor requires wx python and will only run on 2.x.
Pygame.org account Comments
Jeremy Gagnier 2013-11-08 23:32:01
if you make all of your slopes functions your collision detection becomes as simple as solving an equation!
Mekire 2013-11-09 17:07:54
Finding the player's height on the slope is not the issue; that is a simple dictionary look-up in my code. Common issues include the well known problem of flipping between jump state and ground state when running downhill; as well as finding the correct position when one sensor bar is not on a slope, but the other is. These are the parts I should simplify. Using a single sensor bar is much easier to implement but has much less appealing results.
ForcesOfOdin 2015-05-31 12:44:45
The following is a link to a cached google search result from an article titled '2d sprite animation in a tile based setting' and it has some real world solutions to these problems, including those used by megaman, diablo http://webcache.googleusercont...