-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBoBa.py
61 lines (49 loc) · 869 Bytes
/
BoBa.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
'''
BoBa: The Bouncing Ball
By @IanoNjuguna
'''
import turtle
"""
WINDOW
"""
window = turtle.Screen()
window.title("BoBa: The Bouncing Ball")
window.bgcolor("black")
window.setup(width = 800, height = 600)
window.tracer(0)
'''
BoBa SPECS
'''
BoBa = turtle.Turtle()
BoBa.speed(0)
BoBa.shape("circle")
BoBa.color("skyblue")
BoBa.pendown()
BoBa.goto(0, 0)
BoBa.dx = 1
BoBa.dy = 3
'''
MAIN LOOP
'''
while True:
window.update()
'''
MOVE BoBa
'''
BoBa.setx(BoBa.xcor() + BoBa.dx)
BoBa.sety(BoBa.ycor() + BoBa.dy)
'''
BORDER COLLISIONS
'''
if BoBa.ycor() > 290:
BoBa.sety(290)
BoBa.dy *= -1
if BoBa.ycor() < -290:
BoBa.sety(-290)
BoBa.dy *= -1
if BoBa.xcor() > 390:
BoBa.setx(390)
BoBa.dx *= -1
if BoBa.xcor() < -390:
BoBa.setx(-390)
BoBa.dx *= -1