Exemplo n.º 1
0
    def update(self):

        if Time.time_scale == 0.0:
            #Paused game. Adjust timers
            self.time_of_last_invencibily += Time.delta_time(True)

        difference_time = Time.now() - self.time_of_last_invencibily
        if difference_time > self.invecible_time:
            for i in range(2):
                self.player_controller.game_object_list[
                    i].is_invencible = False
            self.get_back_to_original_colors()
            self.current_animation_tick_index = 0
        else:
            value = min(difference_time / self.invecible_time,
                        1)  # Just to convert between 0 and 1
            diff = abs(
                value -
                self.animation_ticks_times[self.current_animation_tick_index])
            if (diff < 0.01):
                self.current_animation_tick_index += 1
                self.tick_colors()

        for obstacle in self.game_object_list:
            if obstacle.transform.position.y > Constants.screen_height:
                self.game_object_list.remove(obstacle)
                obstacle.destroy(obstacle)
                GameObject.destroy(obstacle)
            else:
                self.fall(obstacle)
        self.delete_power_up_text()
Exemplo n.º 2
0
 def update(self):
     """
     NomalBehaivor update method
     will be call every frame
     """
     if self.is_out_of_screen():
         GameObject.destroy(self)
     self.fall()
Exemplo n.º 3
0
    def update(self):

        for obstacle in self.game_object_list:
            if obstacle.transform.position.y > Constants.screen_height:
                self.game_object_list.remove(obstacle)
                obstacle.destroy(obstacle)
                GameObject.destroy(obstacle)
            else:
                self.fall(obstacle)
Exemplo n.º 4
0
    def update(self):

        if len(self.game_object_list) > 0:
            for obstacle_pair in self.game_object_list:
                if obstacle_pair[0].transform.position.y > Constants.screen_height:
                    self.game_object_list.remove(obstacle_pair)
                    for obstacle in obstacle_pair:
                        obstacle.destroy(obstacle)
                        GameObject.destroy(obstacle)
                else:
                    self.fall(obstacle_pair)
Exemplo n.º 5
0
    def update(self):

        for obstacle in self.game_object_list:
            if obstacle.transform.position.y > Constants.screen_height:
                self.game_object_list.remove(obstacle)
                obstacle.destroy(obstacle)
                GameObject.destroy(obstacle)
            else:
                self.fall(obstacle)

            if obstacle.visible and obstacle.transform.position.y > 0.15 * Constants.screen_height:
                self.turn_invisible(obstacle)
                obstacle.visible = False
Exemplo n.º 6
0
 def update(self):
     """
     Will destroy the animation after finished it
     """
     if Time.now() - self.creation_time > self.fade_duration * 2:
         GameObject.destroy(self)