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

Re: [pygame] sprite 'weird' rotation



loved that example! thank you! it recalls me childhood wooden toys! awesome! :)
sent this link to http://identi.ca/group/pygame as well


On 7/20/09, DR0ID <dr0id@xxxxxxxxxx> wrote:
> hi
>
> Maybe that helps you: http://arainyday.se/projects/python/JumpingJack/
>
> Look in the archives, this has been asked before.
>
> ~DR0ID
>
> Paulo Silva schrieb:
>> ok, understood! and thanks about the fixing from the attachment! :)
>>
>> On 7/20/09, Michael George <mdgeorge@xxxxxxxxxxxxxx> wrote:
>>
>>> Note that you would need rotate_point or something similar if you want
>>> to rotate around a point that's not the center.
>>>
>>> Michael George wrote:
>>>
>>>> Oops, I made a type.  See attached
>>>>
>>>> Michael George wrote:
>>>>
>>>>> Actually, after looking more closely, rotate_point wasn't what you
>>>>> needed.  The problem was because when you rotate the image, the
>>>>> output is still an upright rectangle, and you were placing (the upper
>>>>> left corner of) that rectangle in the same place.  If you place the
>>>>> center instead, it works out.  See the attached file for the fixed
>>>>> version.
>>>>>
>>>>> --Mike
>>>>>
>>>>> Paulo Silva wrote:
>>>>>
>>>>>> thanks!
>>>>>>
>>>>>> but btw, i tried to apply it, and the result got more weird - not only
>>>>>> i can't move the sprites independently, as the rotations got much more
>>>>>> weird
>>>>>>
>>>>>> http://pastebin.com/f733ebf04
>>>>>>
>>>>>> (anyway, i'm still newbie on Pygame, and i still struggle a lot about
>>>>>> how Python deals with variables, arrays, lists, and methods )
>>>>>>
>>>>>> if someone know how to fix it, be welcome on editing that, and sharing
>>>>>> us the resulting pastebin url - thanks a lot in advance! :)
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 7/19/09, Michael George <mdgeorge@xxxxxxxxxxxxxx> wrote:
>>>>>>
>>>>>>
>>>>>>> You can use a function from my game:
>>>>>>>
>>>>>>> http://pen.svn.sourceforge.net/viewvc/pen/data/parts/cannon.py?revision=31&view=markup
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> see the rotate_point function
>>>>>>>
>>>>>>> --Mike
>>>>>>>
>>>>>>> Paulo Silva wrote:
>>>>>>>
>>>>>>>
>>>>>>>> hi,
>>>>>>>>
>>>>>>>> i confess it seems a bad handle from me about sprite rotation on
>>>>>>>> Pygame - do someone know better how we can handle it better, making
>>>>>>>> them rotating its center?
>>>>>>>>
>>>>>>>> http://pastebin.com/f53335b66
>>>>>>>>
>>>>>>>> thanks!
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>
>>
>>
>