def __call__(self, world, actor, interval): """Perform the update""" dx = self.parent.x - self.ox dy = self.parent.y - self.oy # if dx or dy: actor.move(dx * self.sx, dy * self.sy) self.ox = self.parent.x self.oy = self.parent.y
def __call__(self, world, actor, interval): """Perform the update""" dx = self.parent.x - self.ox dy = self.parent.y - self.oy # if dx or dy: actor.move(dx*self.sx, dy*self.sy) self.ox = self.parent.x self.oy = self.parent.y
def __call__(self, world, actor, interval): """Perform the motion""" if actor.active: dy = dx = 0 if self._n and self._keyboard.isDown(self._n): dy = -self._speed if self._s and self._keyboard.isDown(self._s): dy = +self._speed if self._e and self._keyboard.isDown(self._e): dx = +self._speed if self._w and self._keyboard.isDown(self._w): dx = -self._speed actor.move(dx, dy)
def __call__(self, world, actor, interval): """Do the movement""" # # Forces offset = self._target - Vec2d(actor.x, actor.y) force = self._spring_constant*offset.length*offset.normalized() damping = -self._damping*self._v # # Update velocity and position self._v += (force + damping)*interval/1000.0 dx, dy = self._v*interval/1000.0 actor.move(dx, dy) # if offset.length < self._dead_zone: return B_COMPLETED
def __call__(self, world, actor, interval): """Do the movement""" # # Forces offset = self._target - Vec2d(actor.x, actor.y) force = self._spring_constant * offset.length * offset.normalized() damping = -self._damping * self._v # # Update velocity and position self._v += (force + damping) * interval / 1000.0 dx, dy = self._v * interval / 1000.0 actor.move(dx, dy) # if offset.length < self._dead_zone: return B_COMPLETED
def __call__(self, world, actor, interval): """Update the actor position""" actor.move(self.vx * interval/1000.0, self.vy * interval/1000.0)
def __call__(self, world, actor, interval): """Update the actor position""" actor.move(self.vx * interval / 1000.0, self.vy * interval / 1000.0)