Commit 302ed548 authored by 12903783's avatar 12903783
Browse files

Added turtle obstacle.

parent 10be050b
......@@ -40,8 +40,8 @@ ball = turtle.Turtle()
ball.shape("turtle")
ball.color("#d2fc03")
ball.penup()
ball.dx = 4
ball.dy = 4
ball.dx = 6.1
ball.dy = 6.1
#Scoreboard 1
scoreboard1 = turtle.Turtle()
......@@ -67,6 +67,14 @@ scoreboard2.pendown()
score_2 = 0
scoreboard2.write("{}".format(score_2), font=("Arial Black", "60"))
#Obstacle
obstacle = turtle.Turtle()
obstacle.shape("turtle")
obstacle.color("brown")
obstacle.penup()
obstacle.goto(100,-150)
obstacle.shapesize(3,3)
#Movement
def racquet1up():
......@@ -114,7 +122,7 @@ while True:
scoreboard1.write("{}".format(score_1), font=("Arial Black", "60"))
if score_1 > 41:
scoreboard1.clear()
scoreboard1.write("tits".format(score_1), font=("Arial Black", "60"))
scoreboard1.write("{}".format(score_1 -5), font=("Arial Black", "60"))
if ball.ycor() < -290:
ball.sety(-290)
ball.dy *= -1
......@@ -134,3 +142,7 @@ while True:
ball.dx *= -1
if (ball.xcor() < -275 and ball.xcor() > -285) and (ball.ycor() < racquet1.ycor() +100 and ball.ycor() > racquet1.ycor() -100):
ball.dx *= -1
if (ball.xcor() > obstacle.xcor() -20 and ball.xcor() < obstacle.xcor() + 20) and (ball.ycor() > obstacle.ycor() -20 and ball.ycor() < obstacle.ycor() + 20):
ball.dx *= -1
obstacle.left(475)
obstacle.forward(200)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment