if direction == DOWN:
if self.y < WORLDHEIGHT - WINDOWHEIGHT - 1:
print "down here"
print self.y,WORLDHEIGHT - WINDOWHEIGHT - 1
print self.player.y,WINDOWWIDTH/2
if self.player.y - 0 < WINDOWHEIGHT/2:
self.player.y += min(WINDOWHEIGHT/2 - self.player.y ,CAMERASPEED)
else:
self.y += min(WORLDHEIGHT - WINDOWHEIGHT-self.y,CAMERASPEED)
elif self.y >= WORLDHEIGHT - WINDOWHEIGHT - 1:
print "down there"
if self.player.y <= WINDOWHEIGHT - 1-self.player.height:
self.player.y += min(WINDOWHEIGHT - 1-self.player.y-self.player.height,CAMERASPEED)
print self.y,self.player.y
class Sq:
def __init__(self,x,y,cam):
self.surf = pygame.image.load("squirrel.png")
self.x = x
self.y = y
self.cam = cam
self.rect = self.surf.get_rect()
self.width = self.rect.width
self.height = self.rect.height
def get_world_x(self):
return self.x + self.cam.x
def get_world_y(self):
return self.y + self.cam.y
CAMERASURF = pygame.display.set_mode((WINDOWWIDTH,WINDOWHEIGHT))
if self.y < WORLDHEIGHT - WINDOWHEIGHT - 1:
print "down here"
print self.y,WORLDHEIGHT - WINDOWHEIGHT - 1
print self.player.y,WINDOWWIDTH/2
if self.player.y - 0 < WINDOWHEIGHT/2:
self.player.y += min(WINDOWHEIGHT/2 - self.player.y ,CAMERASPEED)
else:
self.y += min(WORLDHEIGHT - WINDOWHEIGHT-self.y,CAMERASPEED)
elif self.y >= WORLDHEIGHT - WINDOWHEIGHT - 1:
print "down there"
if self.player.y <= WINDOWHEIGHT - 1-self.player.height:
self.player.y += min(WINDOWHEIGHT - 1-self.player.y-self.player.height,CAMERASPEED)
print self.y,self.player.y
class Sq:
def __init__(self,x,y,cam):
self.surf = pygame.image.load("squirrel.png")
self.x = x
self.y = y
self.cam = cam
self.rect = self.surf.get_rect()
self.width = self.rect.width
self.height = self.rect.height
def get_world_x(self):
return self.x + self.cam.x
def get_world_y(self):
return self.y + self.cam.y
CAMERASURF = pygame.display.set_mode((WINDOWWIDTH,WINDOWHEIGHT))