Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pong code python

# Import required library
import turtle
 
# Create screen
sc = turtle.Screen()
sc.title("Pong game")
sc.bgcolor("white")
sc.setup(width=1000, height=600)
 
 
# Left paddle
left_pad = turtle.Turtle()
left_pad.speed(0)
left_pad.shape("square")
left_pad.color("black")
left_pad.shapesize(stretch_wid=6, stretch_len=2)
left_pad.penup()
left_pad.goto(-400, 0)
 
 
# Right paddle
right_pad = turtle.Turtle()
right_pad.speed(0)
right_pad.shape("square")
right_pad.color("black")
right_pad.shapesize(stretch_wid=6, stretch_len=2)
right_pad.penup()
right_pad.goto(400, 0)
 
 
# Ball of circle shape
hit_ball = turtle.Turtle()
hit_ball.speed(40)
hit_ball.shape("circle")
hit_ball.color("blue")
hit_ball.penup()
hit_ball.goto(0, 0)
hit_ball.dx = 5
hit_ball.dy = -5
Comment

PREVIOUS NEXT
Code Example
Python :: get pattern from string python 
Python :: socket for api in django 
Python :: python mad libs 
Python :: python how do index all odd numbers in a list 
Python :: how to separate date and time in python 
Python :: creating dynamic variable in python 
Python :: python subprocess no such file or directory 
Python :: what mean import in python 
Python :: how to remove .0 from string column with empty strings in python 
Python :: bst in python 
Python :: python excel sheet import 
Python :: print backwards python 
Python :: shebang line python 
Python :: one line try except python 
Python :: converting multipage tiff to pdf python 
Python :: significant figures on axes plot matplotlib 
Python :: how to use self.list.setCurrentRow() in pyqt5 
Python :: perchè il metodo reverse return none 
Python :: fizz buzz python 
Python :: RuntimeError: cannot open featureclass in python 
Shell :: remove phpmyadmin from ubuntu 
Shell :: how to install obs on ubuntu 
Shell :: dotnet ef scaffold sqlite 
Shell :: test angular lib with nx 
Shell :: maven test class 
Shell :: ubuntu apt-get update without input 
Shell :: ubuntu remove temp files 
Shell :: uninstall pytorch 
Shell :: install ngrok ubuntu 20.04 
Shell :: kill port linux 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =