Skip to main content

Slopy Platforming

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
(mekire)

Overview:

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.

 

To run:

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.

 

Controls:

  • Game:
    • 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.

 

Future:

Code still needs to be simplified.  Speed while on slopes needs to decrease proportionately.  Code needs to be generalized (magic numbers removed). 

 

Notes:

The game should run with python 2.x and 3.x.  The map editor requires wx python and will only run on 2.x.

 

Changes

Links

Home Page
https://github.com/Mekire/platformer-with-slopes

Releases

Slopy Platforming 0.1 — 6 Aug, 2013

Pygame.org account Comments

  • jer 2013-11-08 23:32

    if you make all of your slopes functions your collision detection becomes as simple as solving an equation!

    Mekire 2013-11-09 17:07

    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.

    Here are a couple of nice articles on the subject:
    http://www.emanueleferonato.co...
    http://info.sonicretro.org/SPG...

    -Mek

    ForcesOfOdin 2015-05-31 12:44

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

    jer 2013-11-10 19:53

    if you're doing it with functions like I said, there would be no issues with jumping when running downhill... sensor bars would be easy to implement as well. If you want I can program an example of what I mean.