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

Re: [pygame] my rpg game (so far)



> No need to place him on the map itself, as long as you position the
> player so that he is aligned with the background.  I assume you are
> doing scrolling?  If you are scrolling by moving, the background, blit
> the player this way:
> self.screen.blit(self.playerimgs[self.frame],
> (self.x+backgroundx,self.y+backgroundy))
> 
> Your way would work if you create a new copy each time:
> this_frame_bg = self.background.copy()
> this_frame_bg.blit(self.playerimgs[self.frame], (self.x,self.y))
> But it is probably slower to copy a whole surface like this.

I tried it your way, but...

I have it scroll only if the player is more than 1/4 of the screen size
from an edge, so the player can see what is ahead while scrolling. With
your way, and no other modifications, if it is more than that 1/4, it
scrolls but the player doesn't move (it's still on the same map tile),
and can even move off screen if you scroll a lot!