Exemplo n.º 1
0
Arquivo: main_net.py Projeto: th28/acp
def main():
    pygame.init()
    screen = pygame.display.set_mode((WIN_WIDTH, WIN_HEIGHT))
    pygame.display.set_caption("Generic Game")
    playArea = pygame.Surface((640,640))
    pygame.key.set_repeat(200,50)
    players = pygame.sprite.Group()
    enemies = pygame.sprite.Group()
    floorOne = Floor(floors.floor1)
    fogOne = FogOfWar(floorOne)
    ghoul = Enemy(32,128,"data/textures/ghoul.png",10,10,10)
    fow0 = pygame.image.load("data/textures/fow0.png")
    fow2 = pygame.image.load("data/textures/fow2.png")
    
    player = Player(64,64,"data/textures/player.png",100,"Tom","elf",5,11,12,(2,"sword"))
    player2 = Sprite(32,32,"data/textures/ghoul.png")
    player3 = Sprite(96,64,"data/textures/firebat.png")
    player4 = Sprite(64,32,"data/textures/pistol.png")
    enemies.add(player2,player3,player4)
    players.add(player)
    interface = Interface(player)
    clock = pygame.time.Clock()
    camera = Camera(complex_camera,1280,1280)

    floor1 = "data/levels/floor.tmx"
    loader = MapLoader(floor1)
    loader.getData(Tile,Entity)
    
    keepGoing = True
    counter = 0
    while keepGoing:
        interface.update()
        clock.tick(60)
        screen.fill((0,0,0))
        
        #print clock.get_fps()
        player.update(loader.getWalls(),loader.getEnts(),enemies)
        camera.update(player)
        
        
        
        for i in interface.getStats():
            screen.blit(i,(8,interface.getStats().index(i)*20+8))
       
        
        screen.blit(playArea,(210,0))


        for i in loader.getFloor():
            playArea.blit(i.image,camera.apply(i))
   
        for i in loader.getWalls():
            playArea.blit(i.image,camera.apply(i))

        for i in loader.getEnts():
            playArea.blit(i.image,camera.apply(i))

        for i in enemies:
            playArea.blit(i.image,camera.apply(i))
        
       

        
        fogOne.update(player)
        
        
        for i in fogOne.getFowLevels():
            playArea.blit(i.image,camera.apply(i))
        try:
                data = sock.recv(1024)
                print data
                new_pos = parsing(data)
                if new_pos[0] == "2":
                        player2.update(int(new_pos[1]),int(new_pos[2]))
                if new_pos[0] == "3":
                        player3.update(int(new_pos[1]),int(new_pos[2]))
                if new_pos[0] == "4":
                        player4.update(int(new_pos[1]),int(new_pos[2]))
        except socket.error:
                pass
        for i in players:
            playArea.blit(i.image,camera.apply(i))
        pygame.display.update()
Exemplo n.º 2
0
 def __init__(self):
     angles = getData("top500.txt")
     self.len = angles.shape[0]
     self.phi_data = torch.from_numpy(angles[:, 0:-1])
     self.psi_data = torch.from_numpy(angles[:, [-1]])
Exemplo n.º 3
0
Arquivo: main.py Projeto: th28/acp
def main():
    pygame.init()
    screen = pygame.display.set_mode((WIN_WIDTH, WIN_HEIGHT))
    pygame.display.set_caption("Generic Game")
    playArea = pygame.Surface((640,640))
    pygame.key.set_repeat(200,50)
    player1 = pygame.sprite.Group()
    enemies = pygame.sprite.Group()
    floorOne = Floor(floors.floor1)
    fogOne = FogOfWar(floorOne)
    ghoul = Enemy(32,128,"data/textures/ghoul.png",10,10,10)
    fow0 = pygame.image.load("data/textures/fow0.png")
    fow2 = pygame.image.load("data/textures/fow2.png")
    
    player = Player(32,32,"data/textures/player.png",100,"Tom","elf",5,11,12,(2,"sword"))
    player1.add(player)
    interface = Interface(player)
    enemies.add(ghoul)
    clock = pygame.time.Clock()
    camera = Camera(complex_camera,1280,1280)

    floor1 = "data/levels/floor.tmx"
    loader = MapLoader(floor1)
    loader.getData(Tile,Entity)
    
    keepGoing = True
    
    while keepGoing:
        interface.update()
        clock.tick(60)
        screen.fill((0,0,0))
        
        #print clock.get_fps()

        player.update(loader.getWalls(),loader.getEnts(),enemies)
        camera.update(player)
        
        for i in interface.getStats():
            screen.blit(i,(8,interface.getStats().index(i)*20+8))
       
        
        screen.blit(playArea,(210,0))


        for i in loader.getFloor():
            playArea.blit(i.image,camera.apply(i))
   
        for i in loader.getWalls():
            playArea.blit(i.image,camera.apply(i))

        for i in loader.getEnts():
            playArea.blit(i.image,camera.apply(i))

        for i in enemies:
            playArea.blit(i.image,camera.apply(i))
        
        for i in player1:
            playArea.blit(i.image,camera.apply(i))

        
        fogOne.update(player)
        
        
        for i in fogOne.getFowLevels():
            playArea.blit(i.image,camera.apply(i))
        
            
        pygame.display.update()
Exemplo n.º 4
0
import sys
sys.path.append('../')
from perceptron import Perceptron
import loader as l

print l.getData('../../lib/data/DataCiriSuaraParu.xlsx')