Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17625

pygame - jerky movement in general

$
0
0

I've got a huge issue with pygame. Movement is always a bit jerky, even if the code is as simple as can be. Try running this simple example which moves a rect by 1 pixel at 60 FPS:

import sys
import pygame
pygame.init()

display = pygame.display.set_mode((640, 480), pygame.FULLSCREEN)
clock = pygame.time.Clock()
FPS = 60

def motion_test():

    rect = pygame.rect.Rect((0, 240), (40, 40))

    while 1:

        # clear display
        display.fill((0, 0, 0))

        # check quit
        for e in pygame.event.get():
            if (e.type == pygame.QUIT or
                e.type == pygame.KEYDOWN and e.key == pygame …

Viewing all articles
Browse latest Browse all 17625

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>