I'm just making a little game with Pygame. Objects should move across the screen. When I try to do this, a "track" is always dragged along (see picture). How can I move the apple without drawing the "course" of the movement?
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)

This is not pure pygame, it is Pygame Zero. You've to call screen.clear() to clear the display in every frame:
def draw():
    screen.clear()
    apple.draw()
    screen.draw.text("Punkte: " + str(score), (700, 5), color = "white")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With