def create_level(self): self.otherFrame = Frame(self.screen, Rect(0, 0, 800, 700)) self.image_box = ImageBox(self.otherFrame, "data/background.bmp") self.image_box.draw() tmap = TiledMap(self.frame, self.tile_factory) self.level = ColorsLevel( self.level_loader.getlevel(self.current_level), tmap, self.level_loader.getGhostSpeed(self.current_level))
def __init__(self, screen, egen, title_rect, image, menu, menu_rect, moves): self.screen = screen self.events = egen self.events.add_callback(self) frame = Frame(self.screen, title_rect) self.title = ImageBox(frame, image) frame = Frame(self.screen, menu_rect) self.menu = TextMenuBox(frame, menu, self.events, moves)
def __init__(self, frame, image, text="Game Over", delay=2500, \ offset=None, color=None, font=None, sound=None): """Initializes the Game Over Box.""" self.delay = delay self.image = None self.sound = sound if image: self.image = ImageBox(frame, image) self.text = TextBox(frame, text, offset, font, color)
def __init__(self, frame, image=None, text="Game Paused - press any key to continue", egen=None): """Initializes the Pause Box.""" self.image = ImageBox(frame, image) self.text = TextBox(frame, text) if egen == None: egen = EventGenerator() self.egen = egen self.elis = AnyKeyListener(self.pause_ended) self.egen.add_listener(self.elis)
def __init__(self, frame, egen, highscores, highscore_image, textpos): """ frame - Frame instance egen - EventGenerator instance """ self.frame = frame self.egen = egen self.textpos = Vector(textpos) self.highscores = highscores self.image = ImageBox(frame, highscore_image) # for entering new entries self.entering = False self.name = "" self.score = 0
def test_image_box(self, frame, image_filename): """Display image with colorful boxes.""" ib = ImageBox(frame, image_filename) ib.draw() pygame.display.update()