[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] shaking images]



ok well try for example the fallowing code. I think that the shaking of
the image is because of the interpolation. probabely some kind of
filter is needed. i tried the same thing in falsh. with the filters
enabled it looked much smoother. attached is the image for the code.

#############

import sys, pygame

pygame.init()

size = width, height = 320, 240
speed = [2, 1]
black = 0, 0, 0
counter = 0


screen = pygame.display.set_mode(size)

ball = pygame.image.load("form1.bmp")
ball = pygame.transform.scale(  ball, (100,100) )
ballrect = ball.get_rect()

t = 0
v = 0

while 1:

    for event in pygame.event.get():
        if event.type == pygame.QUIT: sys.exit()

    t2 = pygame.time.get_ticks()

    if (t2 - t) > 20:
        t = t2
        v = v + 0.01
        #print v
        x = 50 * v
        y = 10 * v

        ballrect[0] = x
        ballrect[1] = y

        print (x,y)

        screen.fill(black)
        screen.blit(ball, ballrect)
        pygame.display.flip()

##############