示例#1
0
    def late_update(self):
        player = game_world.bring_object(1, 0)

        if player.falling and player.can_up:
            player.falling = False

        pass
示例#2
0
 def late_update(self):
     player = game_world.bring_object(6, 0)
     if intersected_rectangle(self.collided_Rect, self.left, self.top, self.right, self.bottom,
                              player.left, player.top, player.right, player.bottom):
         player.can_up = True
         if player.falling:
             player.falling = False
     pass
示例#3
0
 def late_update(self):
     player = game_world.bring_object(1, 0)
     if self.fill and player.falling:
         player.falling = False
         if player.bottom <= self.top:
             player.y += self.top - player.bottom
             pass
     pass
示例#4
0
 def late_update(self):
     player = game_world.bring_object(6, 0)
     if intersected_rectangle(self.collided_Rect, self.left, self.top, self.right,
                              self.bottom, player.left, player.top, player.right, player.bottom):
         if self.exist:
             player.objectNum += 1
             self.sound.play()
             self.exist = False
示例#5
0
    def late_update(self):
        player = game_world.bring_object(6, 0)

        if intersected_rectangle(self.collided_Rect, self.left, self.top,
                                 self.right, self.bottom, player.left,
                                 player.top, player.right, player.bottom):
            if self.flagOn:
                game_framework.change_state(level_select_state)
        pass
    def late_update(self):
        player = game_world.bring_object(6, 0)
        enemy = game_world.bring_objects(2)
        if self.fill:
            if intersected_rectangle(self.collided_Rect, self.left, self.top, self.right, self.bottom,
                                     player.left, player.top, player.right, player.bottom):
                self.collided_Rect_Height = self.collided_Rect[1] - self.collided_Rect[3]
                self.collided_Rect_Width = self.collided_Rect[2] - self.collided_Rect[0]

                if self.collided_Rect_Width > self.collided_Rect_Height:
                    if self.collided_Rect[1] == self.y + colH:
                        player.falling = False
                        player.y += self.collided_Rect_Height
                    elif self.collided_Rect[3] == self.y - colH:
                        player.y -= self.collided_Rect_Height
                        player.y -= 1
                else:
                    if self.collided_Rect[0] == self.x - colW:
                        player.x -= self.collided_Rect_Width
                    elif self.collided_Rect[2] == self.x + colW:
                        player.x += self.collided_Rect_Width

            for i in enemy:
                if intersected_rectangle(self.collided_Rect, self.left, self.top, self.right, self.bottom,
                                         i.left2, i.top2, i.right2, i.bottom2):
                    self.collided_Rect_Height = self.collided_Rect[1] - self.collided_Rect[3]
                    self.collided_Rect_Width = self.collided_Rect[2] - self.collided_Rect[0]
                    if i.state is 2:
                        i.falling = False

                    if self.collided_Rect_Width > self.collided_Rect_Height:
                        if self.collided_Rect[1] == self.y + colH:
                            i.falling = False
                            if i.state is not 2:
                                i.y += self.collided_Rect_Height
                        elif self.collided_Rect[3] == self.y - colH:
                            if i.state is not 2:
                                i.y -= self.collided_Rect_Height
                                i.y -= 1
                    else:
                        if self.collided_Rect[0] == self.x - colW:
                            if i.state is not 2:
                                i.x -= self.collided_Rect_Width
                        elif self.collided_Rect[2] == self.x + colW:
                            if i.state is not 2:
                                i.x += self.collided_Rect_Width
        else:
            for i in enemy:
                if intersected_rectangle(self.collided_Rect, self.left, self.top, self.right, self.bottom,
                                         i.left2, i.top2, i.right2, i.bottom2):
                    if i.y < self.y:
                        i.x = self.x
                        i.falling = False
                        i.state = 2
示例#7
0
    def late_update(self):

        player = game_world.bring_object(1, 0)

        if player.top <= self.top and self.bottom <= player.bottom:
            if player.x <= self.x:  # 플레이어 -> ㅁ
                player.x -= (player.right - self.left)
            elif player.x >= self.x:  # ㅁ <- 플레이어
                player.x += (self.right - player.left)

        if player.falling:
            player.falling = False
            if player.bottom < self.top:
                player.y += (self.top - player.bottom)

        pass
示例#8
0
    def update(self):

        player = game_world.bring_object(1, 0)

        if self.left - 42 <= player.x <= self.left and self.top <= player.y <= self.top + 32 and player.do_right_action:  # 플레이어 -> 블록
            self.fill = False
        if self.right + 42 >= player.x >= self.right and self.top <= player.y <= self.top + 32 and player.do_left_action:  # 블록 <- 플레이어
            self.fill = False

        if not self.fill:
            self.restore -= 1
            if self.restore == 0:
                self.fill = True
                self.restore = 1000

        pass
示例#9
0
    def update(self):
        objects = game_world.bring_objects(7)
        player = game_world.bring_object(6, 0)
        count = 0
        for i in objects:
            count += 1
        if player.objectNum is count and self.flagOn is False:
            self.flagOn = True
            self.sound.play()

        if self.flagOn:
            self.frame = (self.frame + FRAMES_PER_ACTION * ACTION_PER_TIME *
                          game_framework.frame_time) % 10
        else:
            pass
        pass
示例#10
0
    def update(self):

        player = game_world.bring_object(6, 0)
        crush = game_world.bring_objects(4)
        enemy = game_world.bring_objects(2)

        self.canCrush = True
        for i in crush:
            if i.fill:
                if intersected_rectangle(self.collided_Rect3, self.check2_left, self.check2_top, self.check2_right,
                                         self.check2_bottom,
                                         i.left, i.top, i.right, i.bottom):
                    self.canCrush = False

        for i in enemy:
            if i.state is 2:
                if intersected_rectangle(self.collided_Rect3, self.check2_left, self.check2_top, self.check2_right,
                                         self.check2_bottom,
                                         i.left, i.top, i.right, i.bottom):
                    self.canCrush = False

        if intersected_rectangle(self.collided_Rect2, self.left, self.top, self.right,
                                 self.bottom, player.left, player.top, player.right,
                                 player.bottom) and self.fill:
            if self.left <= player.x <= self.right and self.bottom <= player.y <= self.top and player.state is not 3:
                player.frame = 0
                player.state = 3


        if intersected_rectangle(self.collided_Rect2, self.check1_left, self.check1_top, self.check1_right,
                                 self.check1_bottom, player.left, player.top, player.right,
                                 player.bottom) and player.do_right_action and self.canCrush:
            self.fill = False
        elif intersected_rectangle(self.collided_Rect3, self.check3_left, self.check3_top, self.check3_right,
                                   self.check3_bottom, player.left, player.top, player.right,
                                   player.bottom) and player.do_left_action and self.canCrush:
            self.fill = False

        if not self.fill:
            self.restore -= 1
            if self.restore == 0:
                self.fill = True
                self.restore = 1000
        pass
示例#11
0
    def late_update(self):

        player = game_world.bring_object(6, 0)
        if self.state is STUN:
            if intersected_rectangle(self.collided_Rect, self.left, self.top,
                                     self.right, self.bottom, player.left,
                                     player.top, player.right, player.bottom):
                self.collided_Rect_Height = self.collided_Rect[
                    1] - self.collided_Rect[3]
                self.collided_Rect_Width = self.collided_Rect[
                    2] - self.collided_Rect[0]

                if self.collided_Rect_Width > self.collided_Rect_Height:
                    if self.collided_Rect[1] == self.y + colH:
                        player.falling = False
                        player.y += self.collided_Rect_Height
                    elif self.collided_Rect[3] == self.y - colH:
                        player.y -= self.collided_Rect_Height
                        player.y -= 1
                else:
                    if self.collided_Rect[0] == self.x - colW:
                        player.x -= self.collided_Rect_Width
                    elif self.collided_Rect[2] == self.x + colW:
                        player.x += self.collided_Rect_Width
示例#12
0
    def late_update2(self):
        enemy = game_world.bring_object(1, 1)

        if enemy.bottom < self.top:
            enemy.y += (self.top - enemy.bottom)
示例#13
0
 def late_update2(self):
     enemy = game_world.bring_object(1, 1)
     if not self.fill:
         if enemy.bottom <= self.top:
             enemy.y += self.top - enemy.bottom
             pass
示例#14
0
    def update(self):
        lebbers = game_world.bring_objects(1)
        player = game_world.bring_object(6, 0)

        if self.state is RUN:
            self.frame = (self.frame + FRAMES_PER_ACTION * ACTION_PER_TIME *
                          game_framework.frame_time) % 12

            if intersected_rectangle(self.collided_Rect2, self.left, self.top,
                                     self.right, self.bottom, player.left,
                                     player.top, player.right, player.bottom):
                player.state = 3

            if self.dir is UP:
                self.y += self.velocity * game_framework.frame_time
            elif self.dir is DOWN:
                self.y -= self.velocity * game_framework.frame_time

            self.left = self.x - 32
            self.top = self.y + 32
            self.right = self.x + 32
            self.bottom = self.y - 32

            self.left2 = self.x - colW + 10
            self.top2 = self.y + colH - 10
            self.right2 = self.x + colW - 10
            self.bottom2 = self.y - colH

            if self.dir is UP:
                self.camera_top = self.top + 48
                self.camera_bottom = self.top + 16
                self.camera_left = self.left + 16
                self.camera_right = self.right - 16
            elif self.dir is DOWN:
                self.camera_top = self.bottom - 16
                self.camera_bottom = self.camera_top - 32
                self.camera_left = self.left + 16
                self.camera_right = self.right - 16

            self.change_state_time -= 1

            for i in lebbers:
                if intersected_rectangle(self.collided_Rect, self.camera_left,
                                         self.camera_top, self.camera_right,
                                         self.camera_bottom, i.left, i.top,
                                         i.right, i.bottom):
                    self.change_state_time = 0

            if self.change_state_time < 0:
                self.state = IDLE
                self.change_state_time = 700

        elif self.state is IDLE:
            self.frame = (self.frame + FRAMES_PER_ACTION * ACTION_PER_TIME *
                          game_framework.frame_time) % 11
            if intersected_rectangle(self.collided_Rect2, self.left, self.top,
                                     self.right, self.bottom, player.left,
                                     player.top, player.right, player.bottom):
                player.state = 3

            self.change_state_time -= 1

            if self.change_state_time is 0:
                self.change_state_time = 1000
                self.state = RUN
                if self.dir is UP:
                    self.dir = DOWN
                else:
                    self.dir = UP
        pass
示例#15
0
    def update(self):
        wall = game_world.bring_objects(3)
        crush = game_world.bring_objects(4)
        player = game_world.bring_object(6, 0)
        if self.falling:
            self.y -= RUN_SPEED_PPS * game_framework.frame_time
            if intersected_rectangle(
                    self.collided_Rect2, self.left, self.top, self.right,
                    self.bottom, player.left, player.top, player.right,
                    player.bottom
            ) and player.state is not 3 and self.state is not STUN:
                player.state = 3

        if self.state is RUN and self.falling is False:
            self.frame = (self.frame + FRAMES_PER_ACTION * ACTION_PER_TIME *
                          game_framework.frame_time) % 12
            if intersected_rectangle(self.collided_Rect2, self.left, self.top,
                                     self.right, self.bottom, player.left,
                                     player.top, player.right,
                                     player.bottom) and player.state is not 3:
                player.state = 3
                player.frame = 0
            if self.dir is RIGHT:
                self.x += self.velocity * game_framework.frame_time
            elif self.dir is LEFT:
                self.x -= self.velocity * game_framework.frame_time

            self.change_state_time -= 1

            for i in crush:
                if self.bottom - 40 <= i.y <= self.bottom:
                    if intersected_rectangle(self.collided_Rect2,
                                             self.camera_left, self.camera_top,
                                             self.camera_right,
                                             self.camera_bottom, i.left, i.top,
                                             i.right, i.bottom):
                        self.change_state_time = 0

            for i in wall:
                if self.bottom - 40 <= i.y <= self.bottom:
                    if intersected_rectangle(self.collided_Rect2,
                                             self.camera_left, self.camera_top,
                                             self.camera_right,
                                             self.camera_bottom, i.left, i.top,
                                             i.right, i.bottom):
                        self.change_state_time = 0

            if self.change_state_time < 0:
                self.change_state_time = 500
                self.state = IDLE

        elif self.state is IDLE:
            self.frame = (self.frame + FRAMES_PER_ACTION * ACTION_PER_TIME *
                          game_framework.frame_time) % 11

            if intersected_rectangle(self.collided_Rect2, self.left, self.top,
                                     self.right, self.bottom, player.left,
                                     player.top, player.right, player.bottom):
                player.state = 3

            self.change_state_time -= 1

            if self.change_state_time is 0:
                self.change_state_time = 1000
                self.state = RUN
                if self.dir is RIGHT:
                    self.dir = LEFT
                else:
                    self.dir = RIGHT

        elif self.state is STUN:
            self.rezen_time -= 1
            self.frame = (self.frame + FRAMES_PER_ACTION * ACTION_PER_TIME *
                          game_framework.frame_time) % 11
            if self.rezen_time < 0:
                self.rezen_time = 1000
                self.rezen((self.rezen_position[0], self.rezen_position[1]))
        elif self.state is APPEARING:
            self.frame = (self.frame + FRAMES_PER_ACTION * ACTION_PER_TIME *
                          game_framework.frame_time) % 8
            if self.frame >= 7:
                self.state = RUN

        self.left = self.x - 32
        self.top = self.y + 32
        self.right = self.x + 32
        self.bottom = self.y - 32

        self.left2 = self.x - colW + 10
        self.top2 = self.y + colH - 10
        self.right2 = self.x + colW - 10
        self.bottom2 = self.y - colH

        if self.dir is RIGHT:
            self.camera_left = self.right + 16
            self.camera_top = self.bottom - 16
            self.camera_right = self.camera_left + colW
            self.camera_bottom = self.camera_top - colW
        elif self.dir is LEFT:
            self.camera_left = self.left - 16 - colW
            self.camera_top = self.bottom - 16
            self.camera_right = self.left - 16
            self.camera_bottom = self.camera_top - colH

        pass