[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] rotate sprites, newbie -.-



Hello out there, i am a newbie with python so please do not hunt me down :)
I have a problem with rotating my sprite
The specific code element:

    def update(self, cur_time):
        if self.update_time < cur_time:
            mov_x=math.cos(self.angle)
            mov_y=math.sin(self.angle)
            if self.speed < self.maxSpeed:
                self.speed=self.speed + self.speedKoef* self.angle
            if self.speed < 0:
                self.speed = 0
            pos_xo=self.pos_x
            pos_yo=self.pos_y
            self.pos_x=(self.pos_x + self.speed * mov_x) % self.win_x
            self.pos_y=((self.pos_y + self.speed * mov_y))%self.win_y
            self.next_update_time = cur_time + 10
            self.image=pygame.transform.rotate(self.image,(self.angle))
            self.rect=self.image.get_rect()
            self.rect.top=self.pos_y
            self.rect.left=self.pos_x


called through
            self.dogfighter.update(pygame.time.get_ticks())
            rectlist=self.dogfighter.draw(self.window)
            pygame.display.update(rectlist)
            self.dogfighter.clear(self.window,self.background)


well this rotating lines do not work and it really gives me a strange effect, so
i think there must be something, that i do not understand my own code
I think there must be something i do not understand regarding sprites
Can anyone help me out?

Greetings