SOURCE/PACKAGES/OBJECTS/character.py
def update_frame_dependent(self):
        """
        Updates the image of Sprite every 6 frame (approximately every 0.1 second if frame rate is 60).
        """
        if self.task != -1 and self.task is not None:
            action, target = self.task

            if action == agentcontroller.Action.move or action == agentcontroller.Action.pick:
                if self.speed[0] > 0:
                    self.images = self.images_right
                elif self.speed[0] < 0:
                    self.images = self.images_left

                if self.speed[1] > 0:
                    self.images = self.images_down
                elif self.speed[1] < 0:
                    self.images = self.images_up

            elif action == agentcontroller.Action.shoot:
                target_pos = tuple([ele * 48 for ele in reversed(target)])
                direction = tuple([destination - source
                                   for source, destination in zip(self.pos, target_pos)])

                if direction[0] > 0:
                    self.images = self.images_right
                elif direction[0] < 0:
                    self.images = self.images_left

                if direction[1] > 0:
                    self.images = self.images_down
                elif direction[1] < 0:
                    self.images = self.images_up

        self.current_frame += 1
        if self.current_frame >= self.animation_frames:
            self.current_frame = 0
            self.index = (self.index + 1) % len(self.images)
            self.image = self.images[self.index]

        Updates the image of Sprite every 6 frame (approximately every 0.1 second if frame rate is 60).
        
Updates the image of Sprite every 6 frame (approximately every 0.1 second if frame rate is 60).
Updates the image of Sprite every 6 frame ( approximately every 0 . 1 second if frame rate is 60 ) .
def update_frame_dependent(self):
        if self.task != -1 and self.task is not None:
            action, target = self.task
            if action == agentcontroller.Action.move or action == agentcontroller.Action.pick:
                if self.speed[0] > 0:
                    self.images = self.images_right
                elif self.speed[0] < 0:
                    self.images = self.images_left
                if self.speed[1] > 0:
                    self.images = self.images_down
                elif self.speed[1] < 0:
                    self.images = self.images_up
            elif action == agentcontroller.Action.shoot:
                target_pos = tuple([ele * 48 for ele in reversed(target)])
                direction = tuple([destination - source
                                   for source, destination in zip(self.pos, target_pos)])
                if direction[0] > 0:
                    self.images = self.images_right
                elif direction[0] < 0:
                    self.images = self.images_left
                if direction[1] > 0:
                    self.images = self.images_down
                elif direction[1] < 0:
                    self.images = self.images_up
        self.current_frame += 1
        if self.current_frame >= self.animation_frames:
            self.current_frame = 0
            self.index = (self.index + 1) % len(self.images)
            self.image = self.images[self.index]
def update_frame_dependent ( self ) : if self . task != - 1 and self . task is not None : action , target = self . task if action == agentcontroller . Action . move or action == agentcontroller . Action . pick : if self . speed [ 0 ] > 0 : self . images = self . images_right elif self . speed [ 0 ] < 0 : self . images = self . images_left if self . speed [ 1 ] > 0 : self . images = self . images_down elif self . speed [ 1 ] < 0 : self . images = self . images_up elif action == agentcontroller . Action . shoot : target_pos = tuple ( [ ele * 48 for ele in reversed ( target ) ] ) direction = tuple ( [ destination - source for source , destination in zip ( self . pos , target_pos ) ] ) if direction [ 0 ] > 0 : self . images = self . images_right elif direction [ 0 ] < 0 : self . images = self . images_left if direction [ 1 ] > 0 : self . images = self . images_down elif direction [ 1 ] < 0 : self . images = self . images_up self . current_frame += 1 if self . current_frame >= self . animation_frames : self . current_frame = 0 self . index = ( self . index + 1 ) % len ( self . images ) self . image = self . images [ self . index ]
Updates the image of Sprite every 6 frame (approximately every 0.1 second if frame rate is 60).
Updates the image of Sprite every 6 frame ( approximately every 0 . 1 second if frame rate is 60 ) .
"""
        Updates the image of Sprite every 6 frame (approximately every 0.1 second if frame rate is 60).
        """
self