-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
34 lines (31 loc) · 764 Bytes
/
Copy pathmain.py
File metadata and controls
34 lines (31 loc) · 764 Bytes
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
import time
from turtle import Screen
from player import Player
from car_manager import CarManager
from scoreboard import Scoreboard
FINISH_LINE_Y = 280
screen = Screen()
screen.title("Cross the Turtle")
screen.setup(width=600, height=600)
screen.tracer(0)
player=Player()
Car=CarManager()
score=Scoreboard()
game_is_on = True
screen.listen()
screen.onkey(player.move_forward,"Up")
while game_is_on:
time.sleep(0.1)
if player.ycor()>FINISH_LINE_Y:
player.movement()
Car.car_speed+=10
Car.car_movement()
score.increase_level()
screen.update()
Car.car()
Car.car_movement()
for car in Car.cars:
if player.distance(car)<18:
game_is_on=False
score.game_over()
screen.exitonclick()