Instructions
Download the Python Programming Language IDE and the PyGame module from their respective websites. Open the programming language installation program and run it. Install it to the default installation area.
Open ̶0;Python IDE̶1; from the Start menu. Select the ̶0;File̶1; button from the top menu and then select ̶0;New Window.̶1; Save the file as ̶0;Ping.py.̶1; Type ̶0;import os,sys̶1; followed by a space.
Type ̶0;import pygame̶1; followed by a space and then ̶0;from pygame.locals import.̶1; Press ̶0;Enter̶1; twice and then type ̶0;screen = pygame.display.set_mode((640,480))̶1; and run the program to import the PyGame game commands and game display window.
Create your game character images by typing a variation of this code. Type ̶0;CHARACTER_WIDTH=20̶1; to create a character that is 20 pixels wide. Input a real character name to replace ̶0;CHARACTER.̶1; Press "Enter" to create a new line of programming. Create the height by typing the same line of coding by replacing ̶0;WIDTH̶1; with ̶0;HEIGHT̶1; and changing the number to reflect the different height.
Type ̶0;p1Character = pygame.Shape(x,y, CHARACTER_WIDTH, CHARACTER_HEIGHT.̶1; Replace ̶0;Shape̶1; with the shape you want to use from the PyGame database. Replace the ̶0;x, y̶1; coordinates with the actual numbered coordinates where you want the character to originate.
Create your character and screen color by typing ̶0;CHARACTER_COLOR = pygame.color.Color(̶0;color̶1;)̶1; and ̶0;SCREEN_COLOR = pygame.color.Color(̶0;color̶1;).̶1; Change the ̶0;color̶1; in each parenthesis to indicate the color you want to use for your character and screen.
Program enemies by typing ̶0;enemySpeedX=1̶1; and ̶0;enemySpeedY=1̶1;. Input the enemy name instead of the word ̶0;enemy̶1; into each spot and set whatever speed you want. Create the shape by typing ̶0;ENEMY_COLOR = pygame.color.Color(̶0;color̶1;) and then ̶0;enemy = pygame.Shape(x,y,width, height).̶1; Change the appropriate words to input your own values.
Create your game world by using the same programming methods to draw shapes, such as roads, rectangles and other barriers.
Add collision detection to each of your objects, including the results of the collision. For example, program your character death after colliding with an enemy. Type ̶0;if enemy.collidetect(character): destroy character.̶1;
Program collision detection between your character and boundaries and your enemies and boundaries by typing ̶0;if character.colliderect(boundary): characterSpeedY = characterSpeedY * 0.̶1; This prevents your character from passing through the boundary. Repeat this process with your enemy.
Create movement for your character by programming an input, such as ̶0;if left arrow pressed characterSpeedX = +2.̶1; This will move your character to the right at a speed of two pixels per second. Program the rest of your arrow keys in the same way.
Continue inputting information until you are done with your program. Type ̶0;pygame.display.flip()̶1; at the beginning of your program to draw the graphics to your game. Press ̶0;F5̶1; to run your game.
Play the game to find any flaws, such as enemies not destroying the character or passing through boundaries. Fix the coding errors and replay the game until it runs properly.