class MainMenu(game.State): def __init__(self): super(MainMenu, self).__init__() self.title = Line((game.screen_size[0] / 2, game.screen_size[1] / 4), "Houd de knop ingedrukt", game.get_font('title')) self.cursor = Cursor() self.start_button = Button( (game.screen_size[0] / 2, game.screen_size[1] / 2), self.start_button_pressed) game.global_state_changed.subscribe(self.global_state_changed) def update(self, delta): self.title.update(delta) self.cursor.update(delta) self.start_button.update(delta) def draw(self, surface): self.title.draw(surface) self.start_button.draw(surface) self.cursor.draw(surface) def start_button_pressed(self): game.set_global_state('tutorial') def global_state_changed(self, previous_state, new_state): if new_state is 'main_menu': self.cursor.set_position((0, 0)) self.cursor.cursor_up()