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.

I know this may not help.. but when i move something around i just move the rect that it has. So

rect = rect.move((newpos))

im not that good at pygame so im not positive that that will help, but anyway.

I just figured out what it was.

My being an airhead.
Remember when they tell you "2/3" is the constant 0? Yeah, it was that....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.