为什么我的声音无法播放,我将如何播放?

时间:2019-11-17 01:55:05

标签: python pycharm turtle-graphics

我试图弄清楚为什么我的声音没有播放?我的所有声音文件都应该放在哪里,但仍然听不到声音,因此也放置了链接以获取完整代码的描述。

https://gist.github.com/Ralph94/af9a6a4288a127d399be01324fd588d2

检查与食物和蛇的碰撞:

if head.distance(food) < 15:# Basically saying if our snake head distance to our food is greater then 20
    # Move food to random spot on screen
    x = random.randint(-290, 290)
    y = random.randint(-290, 290)

    food.goto(x, y)# Move to xcor and ycor side of the screen
    winsound.PlaySound("C:/Users/Rafael Perez/PycharmProjects/snake_gamevenv/bite_sound.wav", winsound.SND_ASYNC)
    # Shorten the delay

    delay -= 0.001

    # Increase the score

    score += 10

    if score > high_score:
        high_score = score

    pen.clear()
    pen.write("Score: {}  High Score: {}".format(score, high_score), align="center", font=("Courier", 20, "normal"))

    # add segment 2

    new_segment = turtle.Turtle()
    new_segment.speed(0)
    new_segment.shape("square")
    new_segment.color("black")
    new_segment.penup()

    segments.append(new_segment)

if head.distance(food2) < 15:  # Basically saying if our snake head distance to our food is greater then 20

    # Move food to random spot on screen
    x = random.randint(-290, 290)
    y = random.randint(-290, 290)

    food2.goto(x, y)  # Move to xcor and ycor side of the screen
    winsound.PlaySound("C:/Users/Rafael Perez/PycharmProjects/snake_gamevenv/bite_sound.wav", winsound.SND_ASYNC)
    # Shorten the delay
    delay -= 0.001

    # Increase the score
    score += 10

    if score > high_score:
        high_score = score

    pen.clear()
    pen.write("Score: {}  High Score: {}".format(score, high_score), align="center", font=("Courier", 20, "normal"))

0 个答案:

没有答案
相关问题