1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Turtle layering (probably) [duplicate]

Discussão em 'Python' iniciado por Stack, Setembro 14, 2025.

  1. Stack

    Stack Membro Participativo

    I'm making a rip-off game that's based on those magic tile games where you tap your finger at one of 4 sections at the bottom to play a note. It is always sideways instead. Right now I"m working on letting the player (the black square on the left) move while the animation for the colored tiles is moving. Right now it is just before the functions that draw the tiles, and I have tried putting the functions within the function that makes the tiles.

    import turtle as trtl
    import random as rand

    leader_colors = []
    wn = trtl.Screen()

    player = trtl.Turtle()
    player.speed(150)
    player.penup()
    player.shape("square")
    player.shapesize(7.5)
    player.goto(-850,0)
    player.speed(50)
    def goUp():
    y = player.ycor()
    player.goto(-850, y + 150)

    def goDown():
    y = player.ycor()
    player.goto(-850, y - 150)

    def tileMaker1(many):
    distance = 0
    length = 0
    postion = 1420
    for i in range(many):
    i = trtl.Turtle()
    i.hideturtle()
    i.penup()
    i.pensize(145)
    i.pencolor("white")
    i.shapesize(175)
    i.pensize(145)
    i.penup()
    i.setheading(180)
    i.penup()
    i.shape("square")
    i.shapesize(7.2)
    i.hideturtle()
    i.goto(postion, 0)
    i.showturtle()
    i.penup()
    while distance < 51:
    i.color("blue")
    i.forward(50)
    distance += 1
    length += 50


    wn.onkeypress(goUp, "Up")
    wn.onkeypress(goUp, "w")
    wn.onkeypress(goDown, "Down")
    wn.onkeypress(goDown, "s")

    tileMaker1(4)

    Continue reading...

Compartilhe esta Página