【发布时间】:2020-03-24 08:56:47
【问题描述】:
我只是在用 Pygame 做一个小游戏。对象应该在屏幕上移动。当我尝试这样做时,总是拖着一条“轨道”(见图)。如何在不绘制运动“路线”的情况下移动苹果?
from random import randint
import pygame
WIDTH = 800
HEIGHT = 800
apple = Actor("apple")
apple.pos = randint(0, 800), randint(800, 1600)
score = 0
def draw():
apple.draw()
screen.draw.text("Punkte: " + str(score), (700, 5), color = "white")
def update():
if apple.y > 0:
apple.y = apple.y - 4
else:
apple.x = randint(0, 800)
apple.y = randint(800, 1600)
【问题讨论】:
-
这能回答你的问题吗? How to clear up screen in pygame?
-
@UliSotschok 不,这不能回答问题,因为这是 Pygame Zero 而不是 Pygame 而已
标签: python graphics pygame pgzero