def self_destruct(self): self.delete_this_clone() # For the "original" instance, the delete_this_clone() call should be # a no-op, so we should keep going. The wait_seconds() call is to # test that we can get into the scheduler and back out again. pytch.wait_seconds(0.1) self.kept_running = 'yes'
def award_point(self): if self.get_x() > 225: GlobalVariables.score_1 += 1 else: GlobalVariables.score_2 += 1 self.hide() pytch.broadcast_and_wait('Update_Score') pytch.wait_seconds(0.75)
def play_game(self): self.score = 0 self.go_to_random_spot() self.switch_costume('balloon') self.show() while True: pytch.wait_seconds(3.0) self.go_to_random_spot() self.show()
def move(self): self.change_x(50) pytch.wait_seconds(0.5) self.change_x(60)
def note_event(self): self.n_events += 1 pytch.wait_seconds(0) self.n_events += 1
def invade(self): self.n_steps += 1 pytch.wait_seconds(0.25) self.n_steps += 1
def note_click(self): self.n_clicks += 1 pytch.wait_seconds(0) self.n_clicks += 1
def move(self): self.change_x(50) print('moved once') wait_seconds(0.5) self.change_x(50) print('moved twice')
def delayed_fail(self): pytch.wait_seconds(0.25) print(no_such_variable)
def delayed_fail(self): pytch.wait_seconds(0.25) pytch.no_such_function()
def delayed_fail(self): pytch.wait_seconds(0.25) print(1 / 0)