Beispiel #1
0
 def __init__(self, size, cam, tilePics,itemList,tileCracks,weaponPics,armorPics,over, unit=32, lighting = True,special=True):
     self.size = size
     self.unit = unit
     self.rows = self.size[1] // self.unit
     self.columns = self.size[0] // self.unit
     self.cam = cam
     self.tilePics = tilePics
     self.startLighting = False
     self.itemList = itemList
     self.special = special
     self.entities = []
     self.physics = Physics.physics(self)
     self.AIOn = True
     self.tileCracks = tileCracks
     self.weaponPics = weaponPics
     self.spawners = []
     self.charList = CharacterList.characterList(armorPics)
     self.over = over
     self.armorPics = armorPics
     self.towns = []
     self.tileList = TileList.tileList()
     if lighting == True:
         self.lighting = Lighting.lighting(self)
         self.baseLightLevel = 255
     else:
         self.lighting = False
     self.resetTiles()
     self.resetMetadata()
     '''if lighting == True:
Beispiel #2
0
 def __init__(self,
              size,
              cam,
              tilePics,
              itemList,
              tileCracks,
              weaponPics,
              armorPics,
              over,
              unit=32,
              lighting=True,
              special=True):
     self.size = size
     self.unit = unit
     self.rows = self.size[1] // self.unit
     self.columns = self.size[0] // self.unit
     self.cam = cam
     self.tilePics = tilePics
     self.startLighting = False
     self.itemList = itemList
     self.special = special
     self.entities = []
     self.physics = Physics.physics(self)
     self.AIOn = True
     self.tileCracks = tileCracks
     self.weaponPics = weaponPics
     self.spawners = []
     self.charList = CharacterList.characterList(armorPics)
     self.over = over
     self.armorPics = armorPics
     self.towns = []
     self.tileList = TileList.tileList()
     if lighting == True:
         self.lighting = Lighting.lighting(self)
         self.baseLightLevel = 255
     else:
         self.lighting = False
     self.resetTiles()
     self.resetMetadata()
     '''if lighting == True:
Beispiel #3
0
        controlMen.buttonHovers((mx,my),clicked)#checks for hovers
        controlMen.draw()#draws controls
    elif options == True:
        optionMen.buttonHovers((mx,my),clicked)#checks for hovers
        optionMen.draw()#draws controls        
    pygame.display.flip()#refresh
    clock.tick(60)#set framerate

if play == True:
    background.fill((173, 216, 230))#sets background to sky color
    mainCamera = Camera.camera(screen,0,0,screenSize)#creates camera
    over = Overlay.overlay(screen,font,ItemList.itemList(loadPictures('data/images/Items/')))#creates overlay focussed on player
    worldBack = World.world((10000, 5000),mainCamera,loadPictures('data/images/tiles/'),itemList,tileCracks,weaponPics,armorPics,over,lighting=activeLighting)#creates a world
    worldBack.worldGen('Grassland')#generates the world
    AIOn = worldBack.AIOn#global variable controlling whether the AI is active
    charList = CharacterList.characterList(armorPics)

    player = worldBack.addCharacter(0,True)#creates the player on team player
    player.changeXY(500)#move him/her right 500px

    bottomRow = worldBack.size[1]//32#finds bottom row

    def displayFPS(font):#displays the frames per second
        fps = int(clock.get_fps())#gets fps
        fpsFont = font.render(str(fps), 1, (250, 250, 250))#font renders it
        fpsPos = fpsFont.get_rect()
        fpsPos.centerx = 50
        fpsPos.centery = 50
        screen.blit(fpsFont,fpsPos)

    def setNight():#sets time to night, unused
Beispiel #4
0
        screen, font, ItemList.itemList(loadPictures("data/images/Items/"))
    )  # creates overlay focussed on player
    worldBack = World.world(
        (10000, 5000),
        mainCamera,
        loadPictures("data/images/tiles/"),
        itemList,
        tileCracks,
        weaponPics,
        armorPics,
        over,
        lighting=activeLighting,
    )  # creates a world
    worldBack.worldGen("Grassland")  # generates the world
    AIOn = worldBack.AIOn  # global variable controlling whether the AI is active
    charList = CharacterList.characterList(armorPics)

    player = worldBack.addCharacter(0, True)  # creates the player on team player
    player.changeXY(500)  # move him/her right 500px

    bottomRow = worldBack.size[1] // 32  # finds bottom row

    def displayFPS(font):  # displays the frames per second
        fps = int(clock.get_fps())  # gets fps
        fpsFont = font.render(str(fps), 1, (250, 250, 250))  # font renders it
        fpsPos = fpsFont.get_rect()
        fpsPos.centerx = 50
        fpsPos.centery = 50
        screen.blit(fpsFont, fpsPos)

    def setNight():  # sets time to night, unused