This project you will build your first pygame project. You will create
an object from an image. Have it
respond to keyboard controls by moving. Many of you are still new to
python so I'm assigning a fairly painless first project. As a
relaxation of the syllabus rules, You may use as much code for your L
Line book as you like so long as it is all referenced.
a pygame windowed program. Your program needs to have a sprite class for a
moving object (the rabbit in my project above.). The class should have
at least the __init__ and update methods. You can use any (appropriate) image
file that you might have. I suggest png format images as described in the lecture. Your object needs
to respond to the left right, up and down arrow keys moving in the
appropriate direction when the keys are pressed. Your object should not
move off of the screen, if the user tries to move off of the screen,
simply stop the movement at the edge of the screen.
need a second non moving object sprite (the egg in my version above). When the
first object collides with the second object, your second object should
Your program should end when the user closes the window.
relaxing the maximum 20% "reused" code limit in one case for this lab.
You may use as much code from the book as you like so long as you
reference all of it that you borrow.
Additional Requirements and Submission:
- Make sure that your program won't run if it is merely imported, but only if run as a program (use __name__ for this).
- Make sure to comment your program including documentation comments on all functions, methods and classes.
- Make sure that you have no more than 5 lines of code at the top level (outside of functions or class methods)
- Include a readme.txt in the folder you submit the readme needs to include
- your name
- the version of python (3.x or 2.x) that I should use to grade with.
- how do I run your program
- a brieft description of how your program works
- references for any code you reused from elsewhere
- a list of any functionality that you didn't complete.
- Submit this project by sending me an email with all of the
resources (the whole folder for your project archived into a single
file (no rar files). Make sure your name is part
of the filename and be sure to include it in the comments in the
program file as well.