[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] newbie
> Or like me you can run Ubuntu(Or your distro of choice) inside a VM like Virtual Box. Saves monkeying around looking for Win
> versions of things like grep, wget etc etc.
I have a better choice: run windows inside a VM like Virtual Box in a ubuntu (or your distro of choice) host machine. :) So you will become accustomed to use open source.
I started doing it and finished joining the dark side of the force...
About your first question:
When you clck a key you must set the speed and not the position:
insteand of:
if d == 6:
self.x += sp
will be:
if d == 6:
self.dx += sp #dx as the increment of x to go rigth
elif d==4:
self.dx -= sp #go left
And KEYUP event undo the changes
.....
elif event.type == pygame.KEYUP:
if d == 6:
self.dx -= sp #stop goin to rigth
...
after that, on render, do:
....
self.x += self.dx
...
so the character will still moving while the key is pressed
Well... it was responsed yet, but my mails usually are write-only :P
Bye
--
Nota: Tildes omitidas para evitar incompatibilidades.
:wq