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

Re: [pygame] A bunch of newbie questions



Hi there,

Thanks a bunch - it works (and sorry for my poor explanatory powers :)

cheers!

Naranjito


On Nov 28, 2007, at 8:55 PM, Michael George wrote:

I'm not sure exactly what you want, but

for x in object:
 deadStar.grav(x)

will call deadStar.grav on each sprite in the sprite group "object".

--Mike

Miguel Sicart wrote:
hi all,

thanks a bunch for the answers - I have learnt much, and everything seems to work.
I have an extra question, though. Albeit much more simple:
I have an object with a gravitational method that should affect all objects of one type in the game. How do I pass that method to a sprite group? (like deadStar.grav(object), being object a group of sprites - Python does not like it since the objects lack self.x, self.y before they are instantiated).

Cheers, and thanks for the help,

Naranjito

On 11/27/07, *Dmitrii 'Mamut' Dimandt* <dmitriid@xxxxxxxxx <mailto:dmitriid@xxxxxxxxx>> wrote:


    > if game_mode == "player_alive":
    >     handle_input()
    >     move_player()
    >     if player.is_killed():
    >         if number_of_lives == 0:
    I'd change it to, possibly, if player.number_of_lives , but that
    depends
    on the actual game design