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)
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)
def __init__(self, mlhost, mlport, screen_width, screen_height): """ Create a screen and define some game specific things. """ pymlgame.init() self.screen = pymlgame.Screen(mlhost, mlport, screen_width, screen_height) self.clock = pymlgame.Clock(15) self.reset()
def __init__(self, mlhost, mlport, screen_width, screen_height): """ Create a screen and define some game specific things. """ pymlgame.init() self.screen = pymlgame.Screen(mlhost, mlport, screen_width, screen_height) self.clock = pymlgame.Clock(15) self.gameover = False self.players = {} self.scores = {} self.state = WaitingState(self) self.init_ball()
def __init__(self, mlhost, mlport): """ Create a screen and define some game specific things. """ pymlgame.init() self.screen = pymlgame.Screen(mlhost, mlport, 40, 16) self.clock = pymlgame.Clock(15) part = (int(self.screen.width / 2), int(self.screen.height / 2)) self.snake = Snake([(part[0] - 2, part[1]), (part[0] - 1, part[1]), part], RIGHT, (self.screen.width, self.screen.height)) self.gameover = False self.apple = self.generate_apple() self.apple_surface = pymlgame.Surface(1, 1) self.apple_surface.draw_dot((0, 0), GREEN) self.oldapple = self.apple self.score = 0 self.highscore = self.get_highscore()
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)
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)