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

Re: [pygame] Advice on turning sprite (newbie)



2009/10/26 Luke Paireepinart <rabidpoobear@xxxxxxxxx>:
>
>
> On Mon, Oct 26, 2009 at 6:32 AM, Luke Paireepinart <rabidpoobear@xxxxxxxxx>
> wrote:
>>
>>
>> On Mon, Oct 26, 2009 at 6:25 AM, AdamC <kabads@xxxxxxxxx> wrote:
>>>
>>> I'm learning pygame (also trying to teach my sons in the ins and outs
>>> of python) and am trying to write a small simple game where a tank
>>> moves around the screen on the user's press of the cursor keys. I've
>>> managed to get this working without the tank turning and without using
>>> an object oriented approach. However, I'm now trying to get my tank
>>> working using the following tutorial [0]. My sprite appears on the
>>> screen and the function move_me is called and changes the value of
>>> draw_pos. However, the tank doesn't move.
>>
>> It doesn't move on the screen or it doesn't rotate?  Did you break the
>> movement when you made it OO?
>> What is your specific problem?
>
> Is the version of the code on the pastebin the newest version?  because if
> so, your move function is not setting the new position anywhere.  It is
> calculating a new position, printing it out, and then throwing away that
> value and blitting to the old location.
>
> Also, you shouldn't call a blit function in your move function, you are
> going to end up double-blitting stuff otherwise.  You need to just modify
> your 'pos' value of the class with your new position, don't calculate
> drawpos at all.
>

Currently, the tank doesn't move at all.

The code is the latest, but it is still very much work in progress.
Thanks for the info - will try them out.

Adam