Esempio n. 1
0
def main():
     result = play_game()
     # this can either be visual or textual depending on visual_mode
     draw.draw_game(result)

# # 5. dir and help
# # Just show fiddling around with help and dir in the terminal
Esempio n. 2
0
def main():
    result = play_game()
    draw.draw_game(result)
    clear_screen(result)
    print_role()
    add_role()
    print_role()
    print(sys.path)
Esempio n. 3
0
def _toggle_camera():
    """
    Turns on free camera

    Free camera can move around and pressing enter
    moves to camera location
    """
    camera_on = True
    x, y = config.PLAYER.x, config.PLAYER.y
    free_camera = entity_generator.generate_free_camera()
    free_camera.x = x
    free_camera.y = y
    while camera_on:
        events = pygame.event.get()
        for event in events:
            if event.type == pygame.QUIT:
                pygame.quit()
                sys.exit()

            elif event.type == pygame.KEYDOWN:
                if event.key == pygame.K_a:
                    free_camera.update(-1, 0)
                elif event.key == pygame.K_d:
                    free_camera.update(1, 0)
                elif event.key == pygame.K_w:
                    free_camera.update(0, -1)
                elif event.key == pygame.K_q:
                    free_camera.update(-1, -1)
                elif event.key == pygame.K_e:
                    free_camera.update(1, -1)
                elif event.key == pygame.K_z:
                    free_camera.update(-1, 1)
                elif event.key == pygame.K_c:
                    free_camera.update(1, 1)
                elif event.key == pygame.K_s:
                    free_camera.update(0, 1)
                elif event.key == pygame.K_RETURN:
                    _move_to_free_camera(free_camera)
                    camera_on = False
                elif event.key == pygame.K_TAB:
                    camera_on = False
                elif event.key == pygame.K_ESCAPE:
                    camera_on = False

        config.CLOCK.tick(FPS)
        config.CAMERA.update(free_camera)

        if not config.WALL_HACK:
            config.FOV = fov.new_fov(config.MAP_INFO)

        fov.ray_casting(config.MAP_INFO, config.MAP_INFO.tile_array,
                        config.FOV, config.PLAYER)
        fov.change_seen(config.MAP_INFO, config.MAP_INFO.tile_array,
                        config.FOV)

        draw.draw_game()
        draw.draw_at_camera_offset_without_image(free_camera)
        pygame.display.flip()
Esempio n. 4
0
def main():
    name = play_game()

    # Using the function "draw_game" from the file "draw.py",
    # or in other words, the "draw" module,
    # that implements the logic for drawing the game on the screen
    draw.draw_game(name)

    draw.clear_screen(name)
Esempio n. 5
0
def update_game():
    """
    Updates camera and fov
    """
    # Update what to lock camera on
    config.CAMERA.update(config.PLAYER)

    if not config.WALL_HACK:
        config.FOV = fov.new_fov(config.MAP_INFO)

    fov.ray_casting(config.MAP_INFO, config.MAP_INFO.tile_array, config.FOV,
                    config.PLAYER)
    fov.change_seen(config.MAP_INFO, config.MAP_INFO.tile_array, config.FOV)

    draw.draw_game()
Esempio n. 6
0
 def to_image2(self, piece, img_width, img_height):
     hold = self.queue[0]
     cur = None
     if piece is None:
         preview = self.queue[1:-1]
     else:
         cur = self.queue[1]
         preview = self.queue[2:]
         if hold == piece.t:
             hold, cur = cur, hold
     board = self.board
     return draw_game(hold, piece.blocks if piece is not None else [], piece.t if piece is not None else None, preview, board, None, img_width, img_height)
Esempio n. 7
0
def main():
    result = play_game()
    draw.draw_game(result)
Esempio n. 8
0
def main():
    # "draw_game" does not precede with the name of the module it is imported from,
    # because we have specified the "module name" in the "import" command
    draw_game("ping pong")
Esempio n. 9
0
def main():
    # draw.draw_game() # this is ok
    draw_game(
    )  # this is ok too because from draw.py file, we imported the draw_game() function. main knows the function
Esempio n. 10
0
def main():
    result = play_game()
    # this can either be visual or textual depending on visual_mode
    draw.draw_game(result)
    pass
Esempio n. 11
0
def main():
    result = play_game()
    draw.draw_game(result)
Esempio n. 12
0
def main():
    draw.draw_game("ping pong")
Esempio n. 13
0
def main():
    res = play_game()
    draw_game(res)
Esempio n. 14
0
def main():
    draw.draw_game()
Esempio n. 15
0
def play_game():
    print("Playing game")
    draw.draw_game()
    draw_game()
    reset_game()
    bar.yeah()