In class lesson on how to run Python hello world.
ResourcesIn class lesson on how Python variables, operators, and lists(arrays) are different from Java.
TutorialsIn class lesson on String Formatting, String Operations.
TutorialsWrite an algorithm you know from Java in Python.
In class challenge exercises to write some basic algorithms using Python.
In class lesson on dictionaries.
Watch this video: https://www.youtube.com/watch?v=daefaLgNkw0
Try some dictionary programming exercises.
Additional Tutorial
To fully understand how pygame, and computer games in general, work, read this tutorial:
Below is a list of common errors students get during this unit, along with what it means and how to fix it.
- Anything in pygame is "not initialized": You did not initialize pygame. The fix: Call
pygame.init()
first in main. - pygame anything does not exist: Meaning - you probably named your program "pygame.py" or "import pygame.py" and it is overriding the actual pygame library. The fix: Rename your file "hello.py" or something else.
- Your program was working, but now it says you have an error on line 1 and the console prompt looks like this: >>>: Meaning - Your console
is in python command line instead of windows command line.The fix: Type
exit()
and hit enter. - Something is not being drawn: The fix: First draw the background. Then blit/draw the images and text. Then call
pygame.display.update()
only once at the end of the game loop. Do not put update in an if or another loop. Never call it more than once. blah
is not callable: Meaning - you are callingblah
like it is a function, but it is not. ie. Suppose foo is a function that requires two parameters, a blah and a tuple, but you forgot the comma like this:foo(blah (x,y))
. This will cause this error. The fix: use the comma to separate the parameters to foo:foo(blah, (x,y))
.- Tuples cannot be reassigned: Example
foo = (1, 'hello', 9.2) foo1 = 'world'
. Meaning - Tuples are immutable, which means once they have been assigned, their values cannot be modified. The fix: Use a list instead.foo = 1, 'hello', 9.2 foo1 = 'world'
Complete the 4 video lessons on Hangman.
TutorialsNow make the game yours. Have at least 50 different possible puzzles that are all related to a theme. Redesign the background and images used to reflect the theme.
Assessment6/10 - you finished the tutorial.
8/10 - you added 50 words related to a theme.
10/10 - you redesigned the graphics to reflect the theme and it looks professionally done.
Complete this tutorial on how to do a Platformer Game.
With a partner, write a Horse Oriented Platformer Game.
Before you design your game, you need to know a little bit about horses. Read Horses 101 (Fun Facts, Breeds, Cost, Care, Riding, Etc.).
Design a platformer game where the main character is a horse. The horse should face the kinds of challenges a real horse might face, however, feel free to use a bit of fiction and anthropomorphism to make the game your own. Start with the base code from the Youtube Platformer tutorials.
Basic Criteria - all of the following must be added to the game:- Lives or Health: Add a system of lives or health points for the player. The player should lose a life or health when colliding with enemies or hazards. When all lives are lost, the game should end.
- Food and Water: Each level must include a hay and a water item that must be picked up before leaving the level.
- Multiple Levels: For teams of 2, implement a minimum of 5 new levels. For teams of 3, implement a minimum of 10 new levels. These new levels must NOT BE PART OF THE ORIGINAL GAME. You may use the original game levels if you want, but they don't count Each level should have a unique layout, with increasing difficulty.
- Power-ups: Include power-ups that enhance the player's abilities, such as temporary invincibility, increased speed, or higher jumps. These power-ups should be scattered throughout the levels.
- Save/Load Game: Implement a save and load system that allows players to save their progress and resume from where they left off. Note: this will require saving data to a text file
- Time Limit: Set a time limit for each level, challenging the player to complete the level within a specified time frame. Display a timer on the screen.
- Boss Fight: Create a final boss level where the player must defeat a powerful enemy with specific attack patterns and strategies.
- Customization Options: Provide options for players to customize their character's appearance, such as different skins, colors, or accessories.
- High Scores: Implement a high score system that keeps track of the top scores achieved by different players. Display the high scores on a dedicated screen. Note: this will require saving data to a text file
Assessment Rubric
Milestones
- Milestone 1: Thursday May 30 - One basic criteria met
- Milestone 2: Monday June 3 - Two basic criteria met
- Milestone 3: Friday June 7 - All basic criteria met
- Milestone 4: Tuesday June 11 - Sprites, background, and platform graphics are updated to the ones you want in your final game.
- Final Game Due Tuesday June 18: In Class Demos of Final Game
Complete this tutorial on how to do a simple Tetris Game. Tetris with Pygame Tutorial
Now make it your own by adding any, or all, of the following customizations:
- Hard dropping blocks
- 3 new custom blocks
- speed up as game progresses
- easy, medium, hard levels
- a preview of the next 3 blocks
- high scores saved to a file with user name
- save current game to file and be able to reload
- put a block on hold
Assessment
- Emerging: 1 customization
- Developing: 2-3 customizations
- Proficient: 4-5 customizations
- Extending: 6-7 customizations