Ejemplo n.º 1
0
    def updateHitBox(self):
        a = self.scale * util.cos(self.angle)
        b = self.scale * -util.sin(self.angle)
        c = -b
        d = a

        self.hitbox_pos = [[int(a * x + b * y + self.position[0]),
                            int(c * x + d * y + self.position[1])]
                           for x, y in self.hitbox]
Ejemplo n.º 2
0
    def fixedUpdate(self):
        if self.rotate_left:
            self.rotate = (- self.rotate_speed)
        elif self.rotate_right:
            self.rotate = (self.rotate_speed)
        else:
            self.rotate = 0
        if self.thrust:
            u = (self.speed * util.cos(self.angle - 90))
            v = (self.speed * util.sin(self.angle - 90))
            self.velocity = [(self.velocity[0] + u), (self.velocity[1] + v)]

        super(PlayerShip, self).fixedUpdate()
Ejemplo n.º 3
0
    def update(self, delta):
        interp_position = self.position
        interp_velocity = self.velocity

        interp_angle = self.angle
        interp_rotate = self.rotate

        view_position = [interp_position[0] + (interp_velocity[0]  * delta),
                         interp_position[1] + (interp_velocity[1]) * delta]

        view_angle = interp_angle + (interp_rotate * delta)

        a = self.scale * util.cos(view_angle)
        b = self.scale * -util.sin(view_angle)
        c = -b
        d = a

        self.screen_points = [[int(a * x + b * y + view_position[0]),
                              int(c * x + d * y + view_position[1])]
                              for x, y in self.points]

        super(Sprite, self).update(delta)