Ejemplo n.º 1
0
def checkMiniMapScroll(data):
    mouseStatus = pygame.mouse.get_pressed()
    mouseRegion = Menu.checkRegion(data)
    if mouseRegion == 1:
        mMapx, mMapy = Menu.getMiniMapOrigin()
        if mouseStatus[0] == 1:
            DestX, DestY = data.mouseX - 20, data.mouseY-20
            data.ViewBox.x = DestX - mMapx
            data.ViewBox.y = DestY - mMapy
            if data.ViewBox.x < 0:
                data.ViewBox.x = 0
            if data.ViewBox.x > 128-40:
                data.ViewBox.x = 128-40
            if data.ViewBox.y < 0:
                data.ViewBox.y = 0
            if data.ViewBox.y > 128-40:
                data.ViewBox.y = 128-40
            data.map.x =  -(data.ViewBox.x)*24
            data.map.y = -(data.ViewBox.y)*24