def update(self): collide_list = game_object.collide_with(self.box_collider) for obj in collide_list: if type(obj) == player.Player: if self.kill: obj.die = True else: left1, right1, top1, bot1 = self.box_collider.corners() left2, right2, top2, bot2 = obj.box_collider.corners() if right2 - left1 > bot1 - top2: if right1 - left2 > bot1 - top2: obj.y = int(bot1) + 4 elif right1 - left2 == bot1 - top2: pass else: obj.x = int(right1) else: if right1 - left2 > bot1 - top2: obj.x = int(left1) - obj.box_collider.width elif right1 - left2 == bot1 - top2: pass else: obj.can_jump = True self.gravity.is_activated = False obj.y = int(top1) - obj.box_collider.height - 4 if self.again: for dynamic_obj in game_object.dynamic_objects: dynamic_obj.y -= 1 # self.y -= 1 if int(self.y) == int(self.first_y) - 42: for dynamic_obj in game_object.dynamic_objects: dynamic_obj.again = False # self.again = False break
def update(self): if self.destination == 10: self.player.win = True if self.teleport: collide_list = collide_with(self.box_collider) for obj in collide_list: if type(obj) == Player: for part in game_objects: if type(part) == type(self) and part != self and part.teleport is False \ and part.destination == self.destination: obj.x = part.x obj.y = part.y break break
def update(self): collide_list = game_object.collide_with(self.box_collider) for obj in collide_list: if type(obj) == player.Player: left1, right1, top1, bot1 = self.box_collider.corners() left2, right2, top2, bot2 = obj.box_collider.corners() if right2 - left1 > bot1 - top2: if right1 - left2 > bot1 - top2: obj.y = int(bot1) + 4 elif right1 - left2 == bot1 - top2: pass else: obj.x = int(right1) else: if right1 - left2 > bot1 - top2: obj.x = int(left1) - obj.box_collider.width elif right1 - left2 == bot1 - top2: pass else: obj.can_jump = True self.gravity.is_activated = False obj.y = int(top1) - obj.box_collider.height - 4 break
def update(self): collide_list = collide_with(self.box_collider) for obj in collide_list: if type(obj) == Player: obj.die = True break
def activate(self): collide_list = game_object.collide_with(self.box_collider) for obj in collide_list: if type(obj) != Player: obj.activate() obj.update()