Index

## 1. Tutorial 13

• during this tutorial we will
• understand the PGE API
• create a small snooker game using PGE
• understand how PGE integrates with PyGame

## 2. Using PGE to create a game

• full documentation about PGE is available
• any PGE game or simulation must fix a board frame around our universe

## 3. Framing the universe in PGE

• ```def placeBoarders (thickness, color):
bottom = pge.box (0.0, 0.0, 1.0, thickness, color).fix ()
left = pge.box (0.0, 0.0, thickness, 1.0, color).fix ()
right = pge.box (1.0-thickness, 0.0, thickness, 1.0, color)\
.fix ()
top = pge.box (0.0, 1.0-thickness, 1.0, thickness, color)\
.fix ()
return [bottom, left, right, top]```

• which can be invoked by:
• `sides = placeBoarders (0.01, brown)`

## 4. Run breakout

• examine the breakout game source code
• take a copy of this code and run it from the command line using the Python interpreter
• read the code and mentally make a note about the various sections of code and what they are performing

## 5. Implement snooker in PGE

• now create a new simple PGE program which just creates the boarders (you will need a main which can be borrowed from the breakout example)
• now take a copy and introduce a single moving circle (cue ball) which is dropped from the point 0.5,0.5
• gravity must be turned on!
• now turn gravity off and give this circle an impulse upwards (see the breakout code for a working example of an impulse)
• check the PGE documentation for more details
• observe what happens when the cue ball hits the red balls
• now add a background green to the PGE world
• implement some callbacks for the pockets
• to delete a ‘‘red’’
• reposition the cue ball
• and calculate the ‘‘break’’ value
• continue to work on this program as part of some directed learning throughout the week

## Index

1. Tutorial 13
2. Using PGE to create a game
3. Framing the universe in PGE
4. Run breakout
5. Implement snooker in PGE
6. Conclusion
Index

This document was produced using groff-1.22.