Attempting to scroll a simple background using pygame. This is proving to be near-impossible. It seems that once a surface is blitted anywhere, it WILL NOT blit into a new location.
My two problem functions:
def loadMap(self):
vid = _video._Video()
self._bg = self._map.get_background().get_pyImage()
self._fg = self._map.get_foreground().get_pyImage()
vid.paint(self._bg,0,0)
vid.paint(self._fg,0,0)
def position_screen(self,x,y):
if x>0 or x<-800 or y>0 or y<-1000: return False
vid = _video._Video()
self._viewX=x
self._viewY=y
vid.paint(self._bg,x*(3/4),y*(3/4))
vid.paint(self._fg,x,y)
print "Position: ("+unicode(x)+","+unicode(y)+")"
the Video class is just:
class _Video:
def __init__(self):
pass
def refresh(self):
pygame.display.flip()
def paint(self,surf,x,y):
screen = pygame.display.get_surface()
screen.blit(surf, (x,y))
def load_image(self, name, colorkey=None):
fullname = name#os.path.join('data', name)
try:
image = pygame.image.load(fullname)
except pygame.error, message:
print 'Cannot load image:', fullname
raise SystemExit, message
image = image.convert_alpha()
if colorkey is not None:
if colorkey is -1:
colorkey = image.get_at((0,0))
image.set_colorkey(colorkey, RLEACCEL)
return image, image.get_rect()
The get_pyImage() function simply returns a surface. I've attached the complete source WITH images to demonstrate the problem I'm running into here.
I don't see what could possibly be going wrong here. I'm bliting the damn thing into a new location but it simply WILL NOT BUDGE.
Any help/ideas/thoughts on what could possibly be up with pygame would be appreciated.