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

Re: [pygame] Move sprite and stop it.



B W wrote:
There are no stupid questions. Unless you work at my company where they seem to abound. :)

You need to control all the details of sprite position in a loop with increments and conditions. There's no move_to in Pygame, though many of us have coded our own move_to functions we might be willing to share. There are plenty of basic examples on pygame.org <http://pygame.org> (http://www.pygame.org/wiki/tutorials) that illustrate this much better than we can express in emails.

I checked theese totorials...but everyone stops sprite when it collide the border or other objects, i didn't find how to stop at an arbitrary position. In a forum i found a solution without using a loop...if it solves, i'll show here.
Not sure what you mean by swapping two sprites. Do you mean to replace a sprite's image?

change their position

Sprite1 (x1,y1)
Sprite2 (x2,y2)

swap

Sprite1 (x2,y2)
Sprite2 (x1,y1)

Thanks

Alkatron