Dan Ross wrote:
Here's an example of what I did to keep a player on the screen:
if key[pygame.K_DOWN]:
player.direction = 'down'
if player.rect.bottom < SCREEN_SIZE[1]:
player.move(0, 5)
else:
pass
elif key[pygame.K_UP]:
player.direction = 'up'
if player.rect.top > 30:
player.move(0, -5)
else:
pass
elif key[pygame.K_RIGHT]:
player.direction = 'right'
if player.rect.right < SCREEN_SIZE[0]:
player.move(5, 0)
else:
pass
elif key[pygame.K_LEFT]:
player.direction = 'left'
if player.rect.left > 0:
player.move(-5, 0)
else:
pass
I would think using a similar method would work to limit movement to a certain point.
Dan
Thanks Dan.... is supposed, infact, that i have to make a loop checking
sprite position while it's moving.....but i thought it was a newbie
solution....so i preferred asking here before.
I thought there was something like in cairo move_to(x,y)...if it was not
i'll go by the loop....
Alkatron