Ejemplo n.º 1
0
    def __init__(self, host, port, width, height):
        """
        Create a screen and define some game specific things.
        """
        self.host = host
        self.port = port
        self.width = width
        self.height = height

        self.players = {}

        pymlgame.init()
        self.screen = Screen(self.host, self.port, self.width, self.height)
        self.clock = Clock(15)
        self.running = True
        self.colors = [WHITE, BLUE, GREEN, CYAN, MAGENTA, YELLOW, RED]

        # surfaces
        self.corners = Surface(self.screen.width, self.screen.height)
        self.lines = Surface(
            int(self.screen.width / 2) - 2,
            int(self.screen.height / 2) - 2)
        self.rects = Surface(
            int(self.screen.width / 2) - 2,
            int(self.screen.height / 2) - 2)
        self.circle = Surface(
            int(self.screen.width / 2) - 2,
            int(self.screen.height / 2) - 2)
        self.filled = Surface(
            int(self.screen.width / 2) - 2,
            int(self.screen.height / 2) - 2)
Ejemplo n.º 2
0
    def __init__(self):
        pymlgame.init()

        self.screen = Screen()
        # self.screen = Screen(host='matelight')
        self.clock = Clock(5)

        self.map = Map('1-1')
        self.mario = Mario()

        self.world = self.map.render_pixmap()
        self.colmat = self.map.generate_collision_matrix()

        for y in range(self.map.height):
            print('%02d %02d ' % (y, self.convert_y(y)), end='')
            for x in range(self.map.width):
                print(self.colmat[x][y], end='')
            print()

        self.gameover = False

        self.camera = Camera(self.map.width, self.map.height)
Ejemplo n.º 3
0
    def __init__(self, host, port, width, height):
        """
        Create a screen and define some game specific things.
        """
        self.host = host
        self.port = port
        self.width = width
        self.height = height

        self.players = {}

        pymlgame.init()
        self.screen = Screen(self.host, self.port, self.width, self.height)
        self.clock = Clock(5)
        self.running = True
        self.colors = [WHITE, BLUE, GREEN, CYAN, MAGENTA, YELLOW, RED]
        self.color_length = math.ceil(self.screen.height / len(self.colors))

        # surfaces
        self.game_board = None
        self.init_game_board()

        self.dots = Surface(self.screen.width, self.screen.height)