Pong is one of the earliest arcade video games. It is a table tennis sports game featuring simple two-dimensional graphics. The game was originally manufactured by Atari, which released it in 1972. Allan Alcorn created Pong as a training exercise assigned to him by Atari co-founder Nolan Bushnell. Bushnell based the idea on an electronic ping-pong game included in the Magnavox Odyssey, which later resulted in a lawsuit against Atari. Surprised by the quality of Alcorn's work, Bushnell and Atari co-founder Ted Dabney decided to manufacture the game. We won't be creating the entire game but using the concept to get to grips with object orientated programming and the use of classes. Below is a cool video on "Gaming through time"
Copy and paste the code below. Run it! Read the task and see if you can do it before moving on to the next challenge
""" ===========Task============== 1. Type this out for yourself to familiarise yourself with the setup 2. Change the variables/parameters and have a play around - e.g. Game title, background colour, etc """ from tkinter import * import random import time tk=Tk() #creating a tk object tk.title("My 21st Century Pong Game") #give the window a title, using the title function of the tk object tk.resizable(0,0) #resizable makes the window a fixed size tk.wm_attributes("-topmost",1) #the wm_attributes tell tkinter to place *this* window infront of all other windows canvas=Canvas(tk,bg="red",width=500,height=400,bd=0,highlightthickness=0) #create canvas and create a few additional features, passing in parameters for border and thickness canvas.pack() #tells the canvas to size itself according to the width and height parameters just given tk.update() #update tells tkinter to initialise itself for the animation in the game to come - this last line is very important as otherwise things wouldn't quite work correctly!
A sample flow chart (design) for this particular challenge could look like:
Test No. | Description | Test Data(input) | Expected Outcome | Actual Outcome | Further Action? |
---|---|---|---|---|---|
1 | |||||
2 | |||||
3 | |||||
4 | |||||
5 |