Is the pen in Turtle graphics an object that can be interacted with or no?

335 Views Asked by At

I want to make a game in the turtle module similar to "Lunar Lander" by Atari but I'm not sure if I'll be able to make a collision system if I draw the terrain using a turtle. Any help would be appreciated.

1

There are 1 best solutions below

1
kimilao On

I don't think python turtle have the collision system, but you can make the limit for the ground. Such as if the ground surface is on -40y, then you can create a variable and prevent the object from going through the ground.

groundLimit = -40  #create the limit for the object
while True:
    if turtle.ycor() < 40:  #check if the object hit the ground
        turtle.sety(40)   #make the object on the ground again
#but this method might make the object a bit weird

But if you are making a game, I would suggest using the "pygame" module. It's great for making games and better than turtle. Turtle is just for drawing, but pygame is for making games. You can find tutorials online to help you.

Good Luck!