4.7 - Practice Problems



Make a two-player hockey game! The application will consist of two rectangular paddles, starting on each side of the screen, and one circular ball that players must bounce around. Players can move the paddles in any direction to hit the ball into the goal. If the ball makes contact with safe parts of the screen, it will bounce off at a random angle but in the same general direction (left or right). It will do the same if it makes contact with one of the paddles but will head towards the opposite general direction instead. If the ball touches the goals on either side of the screen, the application will say “Game Over. Player _ Wins”. You must put your code in classes and have separate keys for each player to move their paddles.
This will probably take a while. However, you can do it if you approach the problem step by step: 1. Define your base object class (if the objects are similar) 2. Create your actual object classes 3. Create your base App class 4. Create the real Hockey class

Flappy Bird

Create the Flappy Bird game! You are provided with starting code and game resources. The starting code, however, doesn’t run by itself.
In order to make it run, you have to: 0. Setup by downloading the zipped template code and icons (flappy_bird.zip) and unzipping it. The code file you will be editing is OOPflappybird.py 1. Define GameObj’s draw method 2. Define GameObj’s check_collision method 3. Complete all the methods within the Tubes class 4. Complete the draw_score and draw_buttons methods in the FlappyBird class
Copyright © 2021 Code 4 Tomorrow. All rights reserved. The code in this course is licensed under the MIT License. If you would like to use content from any of our courses, you must obtain our explicit written permission and provide credit. Please contact classes@code4tomorrow.org for inquiries.