def update(self): if self.MOVE_LEFT: self.move() if self.MOVE_RIGHT: self.move(-1) for person in self.game.g_objects: if person is not self: for item in person.give_all_obj(): q = Geo.quarter_direction(self.get_position(), item.get_position()) if not person.is_inside: q = Vec2(q) * -1 force = Geo.to_centre(self.get_position(), item.get_position()) force = force[0] * q[0] * self.gravity, force[1] * q[1] * self.gravity # item.body.ApplyLinearImpulse(force, item.get_position(), wake=True) GameObject.update(self)
def update(self): # ahhh! # o_ / # _/\\ # \| # /|~ # _\|_ # / # ___O_____ # # Keep the old value for the autoBalance function to use self.unicycle._thetaFB_old = self.unicycle.thetaFB if self.unicycle.isFallen: self.rider.move() if pygame.time.get_ticks() - self.timeFallen > 1000: self.reset() return if self.unicycle.isFallenOver(): self.rider.velocity = self.unicycle.velocity.copy() self.timeFallen = pygame.time.get_ticks() if self.sound: self.sound.grunt() return # Base class update stuff GameObject.update(self.unicycle) GameObject.update(self.rider) self.wobble() # Adjust the acceleration to match the angle self.autoBalance() # update unicycle position using wheel accn self.unicycle.move() # update rider position by sticking him back on the top of the unicycle self.rider._position = self.unicycle.position + self.unicycle.orientation / linalg.norm( self.unicycle.orientation) * UNICYCLE_HEIGHT
def update(self, dt): GameObject.update(self, dt)