Как мне заставить моих "плохих парней" столкнуться с моей черепахой, исчезнуть и снова появиться? - PullRequest
0 голосов
/ 15 октября 2019

Я пытаюсь заставить моих плохих парней столкнуться с моей ракетой, которая является моей черепахой, но не знаю как ?. Вот код и поставить ссылку для полного описания кода, чтобы помочь:

class Bad_guys(turtle.Turtle):
    def __init__(self):
        # since we are using the Turtle module we are able to use it's built in functions
        turtle.Turtle.__init__(self)
        self.penup()  # our attributes
        self.speed(0)
        self.shape("circle")
        self.color("red")
        self.velocity = 3  # xcor                    #ycor
        self.goto(random.randint(-150, 250), random.randint(-150, 250))
        self.setheading(random.randint(0,160))

    def jump(self):  # Jump = Collidee
        self.goto(random.randint(-250, 250), random.randint(-250, 250))  # "jump" stands for Collidee so if the circle "jumps" with player it will move to random postion by 250 and -25
        self.setheading(random.randint(0, 360))  # from where it collidee's it goes 360 moves location 360 Right

    def move(self): # we copyed the same method cause it will be doing the same movements as the player we want it to go "forward" with our set "speed" & also check for our borders we set
        self.forward(self.velocity)


        # Border Checking
        if self.xcor() > 290 or self.xcor() < -290:  # Left side is -290 Right side is 290 we also want the coordinates x and y to be below 300 to not go over our border
            self.left(60)
        if self.ycor() > 290 or self.ycor() < -290:
            self.left(60)

Ralph94

...