In this we will be doing the basic movements of the turtle. So first we will do all the imports and starting up stuff like Screen, Turtle, shape, and other stuff. So start by putting this into your code:
import turtle mover = turtle.Turtle() mover.up() mover.shape("square") listenner = turtle.Screen() mover.speed(0) mover.goto(-250, 0)
Now we’re going to check if the Up button is pushed (using the onkey function so we don’t have to push enter!). So type this in to your code:
while True: def forward(): mover.forward(10) listenner.onkey(forward, "Up")
Now we can do backwards left and right!
def backward(): mover.backward(10) listenner.onkey(backward, "Down") def right(): mover.right(10) listenner.onkey(right, "Right") def left(): mover.left(10) listenner.onkey(left, "Left") listenner.listen()
At the end of all the code it should look like a square on a white screen that you can move around with the arrow keys
i cant move it around
what's your problem?
like not in real life, but what's the problem with the coding=>
@gatorade322well,for startes i type in all of the code and once all of thats done i press run it doesnt give any errors i just cant move around
@gatorade322also when are you going to make part 2?
I did make part two, and also, maybe you could show me the code that you typed
@gatorade322k i will send you a invite
@neelninja I fixed it up. It looked like there were just some indenting problems . . . (:
Making 2D Minecraft With Python: Part One
In this we will be doing the basic movements of the turtle. So first we will do all the imports and starting up stuff like Screen, Turtle, shape, and other stuff. So start by putting this into your code:
Now we’re going to check if the Up button is pushed (using the onkey function so we don’t have to push enter!). So type this in to your code:
Now we can do backwards left and right!
At the end of all the code it should look like a square on a white screen that you can move around with the arrow keys
i cant move it around
what's your problem?
like not in real life, but what's the problem with the coding
=>
@gatorade322
well,for startes i type in all of the code and once all of thats done i press run it doesnt give any errors i just cant move around
@gatorade322
also when are you going to make part 2?
I did make part two, and also, maybe you could show me the code that you typed
@gatorade322
k i will send you a invite
@neelninja I fixed it up. It looked like there were just some indenting problems . . . (: