Example #1
0
    def update(self, dt):

        if not self.cutscene_controlling:
            self.update_timer += 1
            #pick random direction (currently only one of 8 directions, but at a random speed)

            if not self.held_by is None:
                held_o = self.game_class.objects[self.held_by]
                self.current_speed = 0
                self.coord = held_o.coord[0] + self.centre_offset[0], held_o.coord[1] + self.centre_offset[1]

            elif self.update_timer >= 50 and not self.fear_timer:
                self.update_timer = 0

                self.move_down = False
                self.move_up = False
                self.move_left = False
                self.move_right = False

                for i in self.idle_functions:
                    i()

            if self.possessed_by:
                for p in self.possessed_by:
                    p.coord = self.coord



        GameObject.update(self, dt)
Example #2
0
    def update(self, dt):

        if not self.cutscene_controlling:
            self.update_timer += 1
            #pick random direction (currently only one of 8 directions, but at a random speed)

            if not self.held_by is None:
                held_o = self.game_class.objects[self.held_by]
                self.current_speed = 0
                self.coord = held_o.coord[0] + self.centre_offset[
                    0], held_o.coord[1] + self.centre_offset[1]

            elif self.update_timer >= 50 and not self.fear_timer:
                self.update_timer = 0

                self.move_down = False
                self.move_up = False
                self.move_left = False
                self.move_right = False

                for i in self.idle_functions:
                    i()

            if self.possessed_by:
                for p in self.possessed_by:
                    p.coord = self.coord

        GameObject.update(self, dt)
Example #3
0
    def update(self, dt):
        if not self.cutscene_controlling:
            if self.possessed_by:
                self.update_while_possessed(dt)
            else:
                self.update_idle_or_feared(dt)

        if not self.can_walk or self.held_by: # check this after, things other than walking may occur in above functions
            self.move_down = False
            self.move_up = False
            self.move_left = False
            self.move_right = False

        GameObject.update(self, dt)

        for o in self.held_objects:
            o.coord = self.coord[0] + self.held_offset[0], self.coord[1] + self.held_offset[1]