def update(self, inputs, t, dt, collision_detector): self.time_left -= dt self.position = self.position + self.forces all = collision_detector.collides(token=self.token, filters=self.environment_filters) if len(all) > 0: normal = Vector() for c in all: if normal.dot(c.translation_vector) == 0: normal += c.translation_vector self.position += normal collision_detector.update_collidable(self.token, self.collidable)
def update(self, inputs, t, dt, collision_detector): self.time_left -= dt self.position = self.position + self.forces all = collision_detector.collides(token=self.token, filters=self.environment_filters) if len(all) > 0: normal = Vector() for c in all: if normal.dot(c.translation_vector) == 0: normal += c.translation_vector self.position += normal collision_detector.update_collidable(self.token, self.collidable)
def update(self, inputs, t, dt, direction, collision_detector): super(CollidableCharacter, self).update(t, dt, direction) self.position = self.position + direction * dt + self.forces all = collision_detector.collides(token=self.token, filters=self.environment_filters) if len(all) > 0: normal = Vector() for c in all: if normal.dot(c.translation_vector) == 0: normal += c.translation_vector self.position += normal collision_detector.update_collidable(self.token, self.collidable) self.reset_force()
def update(self, inputs, t, dt, collision_detector): if not self.explosion_triggered: self.time_left -= dt if self.time_left <= 0.0: self._trigger() self.position = self.position + self.forces * self.slow_factor all = collision_detector.collides(token=self.token, filters=self.environment_filters) if len(all) > 0: normal = Vector() for c in all: if normal.dot(c.translation_vector) == 0: normal += c.translation_vector self.position += normal collision_detector.update_collidable(self.token, self.collidable) else: self.explosion_time_left -= dt self.reset_slow(t)
def update(self, inputs, t, dt, collision_detector): if not self.explosion_triggered: self.time_left -= dt if self.time_left <= 0.0: self._trigger() self.position = self.position + self.forces * self.slow_factor all = collision_detector.collides(token=self.token, filters=self.environment_filters) if len(all) > 0: normal = Vector() for c in all: if normal.dot(c.translation_vector) == 0: normal += c.translation_vector self.position += normal collision_detector.update_collidable(self.token, self.collidable) else: self.explosion_time_left -= dt self.reset_slow(t)