0

Trying to figure out how I can move my turtle down instead of just left and right here is the code and link below:

class Player(turtle.Turtle):  # since it got inherited this class becomes a Superclass/SUPER CLASS
    def __init__(self):  # self is our only argument here but it will have multiple attributes
        turtle.Turtle.__init__(self)  # since we are using the Turtle module, we are able to use it's built in functions
        self.penup()# our attributes
        self.speed(0)
        self.shape("C:/Users/Rafael Perez/PycharmProjects/hello/venv/r7.gif")
        self.color("black")
        self.velocity = 0.1

    def move(self):
        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)

    def turnleft(self):
        self.left(30)

    def turnright(self):
        self.right(30)

    def down(self):
        self.forward(30)

    def increasespeed(self):
        self.velocity += 1

Ralph94

VietHTran
  • 2,233
  • 2
  • 9
  • 16
Ralph9496
  • 19
  • 7
  • By down you mean turning 180 degree backwards from its current position or moving down the screen? – VietHTran Oct 15 '19 at 00:21
  • probably if you press arrow few times then it will turn down and then you can go forward to the bottom of screen. – furas Oct 15 '19 at 01:18
  • i mean by going down the screen @VietHTran – Ralph9496 Oct 16 '19 at 00:12
  • and @furas what do you mean? – Ralph9496 Oct 16 '19 at 00:14
  • I means you have `turnleft()` and `turnright()` which turns 30 degrees - if you press left or right arrows few times then you can turn in any direction and then using up arrow which runs `down()` you can move forward to the bottom. – furas Oct 16 '19 at 00:43
  • I even run code right now and I can move to the bottom - but after removing few errors which you should see if you run code in terminal/console/cmd.exe – furas Oct 16 '19 at 00:44
  • Which errors where removed and where did you edit the code at @furas? – Ralph9496 Oct 16 '19 at 02:36
  • I took code from link and run on my computer, and I removed errors on my computer. These errors are still in code in your link. For example code has wrong indentations and it use one function which doesn't exists. If you run code in terminal/console/cmd.exe - `python scriptp.py` - then you should see it. – furas Oct 16 '19 at 02:44
  • Okay got it thank you for your help @furas ! – Ralph9496 Oct 16 '19 at 07:03

0 Answers0