الاشكال المختلفه

المسافه بين المضرب و الشكل كبيره

#نص منسَّق سابقًا
#main
from turtle import Turtle, Screen
from hold import Hold
from shapes import Shapes
from scores import Score
import time

screen = Screen()
screen.bgcolor(“black”)
screen.title(“Hold The Shapes”)
screen.setup(width=800, height=600)
screen.tracer(0)

hold = Hold()
shape = Shapes()
score = Score()

screen.listen()
screen.onkey(hold.move_right,“Right”)
screen.onkey(hold.move_left,“Left”)

game_on = True
speed = .1
while game_on:
screen.update()
time.sleep(speed)

#حركة الشكل لاسفل
#shape.move()
shape.goto(shape.xcor(), shape.ycor()-10)
#في حالة تجاوز من الاسفل
if shape.ycor() < -300 :
    shape.show_shapes()
    time.sleep(speed *.8)
# الصطدام بالمضرب
if shape.ycor() >= -230 and shape.distance(hold) < 50:
    if shape.shape() == "turtle" and shape.color()[0] == "white":
        score.game_over()
        game_on = False
    elif shape.shape() == "square": #and shape.ycor() >= -260 and shape.distance(hold) <= 50:
        score.add_acount_s()
        shape.show_shapes()
    elif shape.shape() == "circle": #and shape.ycor() >= -260 and shape.distance(hold) <= 50:
        score.add_acount_c()
        shape.show_shapes()
    elif shape.shape() == "turtle": #and shape.ycor() >= -260 and shape.distance(hold) <= 50:
        score.add_acount_Tu()
        shape.show_shapes()
    elif shape.shape() == "triangle": #and shape.ycor() >= -260 and shape.distance(hold) <= 50:
        score.add_acount_t()
        shape.show_shapes()

screen.exitonclick()

اكتب الرمز أو الصقه هنا #shapes
from turtle import Turtle
import random

class Shapes(Turtle):


    def __init__(self,):
        super().__init__()
        self.shapes = ("turtle", "square", "circle", "triangle")
        self.colors = ("red", "yellow", "white", "green", "blue")
        self.y_move = -10

        self.show_shapes()
    
    def move(self):
        self.goto(self.xcor(), self.ycor() + self.y_move)

    
    def show_shapes(self):
   
        self.color(random.choice(self.colors))
        self.shape(random.choice(self.shapes))
        self.shapesize(random.uniform(0.5,2))
        self.penup()
        #لجعل الاشكال تظهر من اعلي الشاشه
        random_show_x = random.randint(-380, 380) 
        self.goto(random_show_x,250)   
    
اكتب الرمز أو الصقه هنا
```#paddel
from turtle import Turtle

class Hold(Turtle):
    def __init__(self) -> None:
        super().__init__()
        self.shape("square")
        #self.left(90)
        self.color("white")
        self.shapesize(stretch_wid=1,stretch_len=5)
        self.penup()
        self.goto(0,-250)

    def move_left(self):
        new_x = self.xcor() - 40
        #لمنع المضرب يخرج خرج الحدود اليمين و اليسار
        if new_x > -350:
            self.goto(new_x, self.ycor())
        #self.goto(self.xcor()-40,self.ycor())
    def move_right(self):
        new_x = self.xcor() + 40
        if new_x < 350:
            self.goto(new_x, self.ycor())
        #self.goto(self.xcor()+40,self.ycor())

اكتب الرمز أو الصقه هنا

from turtle import Turtle

class Score(Turtle):
    def __init__(self):
        super().__init__()
        self.color("white")
        self.hideturtle()
        self.count = 0
        self.display_score()

    def display_score(self):
        self.clear()
        self.penup()
        self.goto(0,250)
        self.write(f"{self.count}", align="center", font=("courier", 35 , "normal"))
        
    def add_acount_s(self):
        self.count += 2
        self.display_score()
    def add_acount_c(self):
        self.count += 1
        self.display_score()
    def add_acount_t(self):
        self.count = 0
        self.display_score()
    def add_acount_Tu(self):
        self.count += 5
        self.display_score()
    def game_over(self):
        self.home()
        self.penup()
        self.goto(0,0)
        self.color("red")
        self.write(f"Game Over",  align="center", font=("courier", 35 , "normal"))