[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] shaking images]
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] shaking images]
- From: "michael gross" <mich@xxxxxxxxx>
- Date: Wed, 4 Jan 2006 18:08:22 +0100 (CET)
- Delivered-to: archiver@seul.org
- Delivered-to: pygame-users-outgoing@seul.org
- Delivered-to: pygame-users@seul.org
- Delivery-date: Wed, 04 Jan 2006 12:09:16 -0500
- Importance: Normal
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
- User-agent: SquirrelMail/1.4.2
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()
##############