I'm working through various PyGame introductory tutorials at the moment and I've just finished looking through the Chimp example (located here).
I was hoping someone could explain to me why the below code will not make the Surface object (the chimp image) bounce off the bottom of the display Surface and begin moving towards the top again:
def _walk(self):
newpos = self.rect.move((self.move,1))
if self.rect.left < self.area.left or \
self.rect.right > self.area.right or \
self.rect.top < self.area.top or \
self.rect.bottom > self.area.bottom:
self.move = -self.move
newpos = self.rect.move((self.move,-1))
self.image = pygame.transform.flip(self.image,1,0)
self.rect = newpos
It seems to move the object down the screen alright, but does not cause it to reverse position. Rather it gets stuck at the bottom of the display Surface.
I have seen some similar questions asked but I can't quite make heads or tails of the explanations, so my apologies in advance if people see this all the time.
Thanks in advance!