Side-scroller

From OLPC
Jump to navigation Jump to search

Documentation for the side-scroller (Under Construction):

The side-scroller engine allows for easy level creation, image-swapping, and enemy customization. None of these require any skill in programming, but does require Python (version 2.4 and above recommended) and pygame (version 1.7 recommended) to be installed. Directions to installing python and pygame can be found elsewhere on the OLPC Wiki - Links to be posted here later.


Tutorial:

I suggest playing the game first, so you can get an idea what I mean by "tile" and "player image" and a few other terms. To do so, run play.py or at the terminal:

your_name@computer_name:~$python ~/path_name_here/play.py

This should start the game assuming you have Python 2.4 or above and pygame 1.7 or above.

After a few games, open up play.py in your favorite text editor or Integrated Development Enviornment. side_scroller.py is the nitty-gritty code that, while you can change, it's not wholeheartedly recommended unless you know the programming language Python.

You will see the following variables under the words "def main():"

screen_width -> This variable determines how wide you want the screen to be, in number of tiles. screen_height -> This variable determines how tall you want the screen to be, in number of tiles. tile_size -> This variable determines both how wide and how tall you want a single tile to be, in number of pixels.

I suggest 25 tiles by 19 tiles, with a tile size of 32 pixels. If you experience extreme slowdown at these settings, then, after emailing me the details of your computer and play.py file, you could try lowering the width or height of your levels.

player_lives -> The number of lives you want the player to have initially. player_coins -> The number of collectible items (they don't have to be coins) you want the player to have initially. player_can_go_backward -> You can set this to either True or False, depending on whether you want the player to revisit screens he or she has been to previously. If you do not understand, try setting it to False and playing the game again, and after moving forward one screen, you will find the player cannot move to the previous screen.

complex_enemy_collision -> This creates more checks for horizontal collision detection. It is recommended you keep it off as it may cause some slowdown, unless you are experiencing collision detection problems with enemies (and if, after turning it on, you are still having issues, please email me, see bottom for details).

game_title -> What will appear at the top of the screen upon playing your game. Please remember to keep the quotes, or else python will give you errors! player_image_list -> This list contains four filenames, each with quotes and seperated by commas. These four images correspond to the image the player will take on upon receiving one of the power ups. Respectively, they are [normal image, alter-image powerup image, higher-jumping powerup image, flying powerup image].




This page and the side-scroller engine were created by Patrick DeJarnette in conjunction with Google's Summer of Code 2007. Feel free to email me at pepboy@uchicago.edu or AIM screen-name pepboy013.