Beispiel #1
0
    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)
Beispiel #2
0
    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)
Beispiel #3
0
    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()
Beispiel #4
0
    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)
Beispiel #5
0
    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)